Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e19c5a1

Browse filesBrowse files
[DowCrawler] Fix locale-sensitivity of whitespace normalization
1 parent f86f383 commit e19c5a1
Copy full SHA for e19c5a1

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,15 +620,15 @@ public function text(/* string $default = null, bool $normalizeWhitespace = true
620620
$text = $this->getNode(0)->nodeValue;
621621

622622
if (\func_num_args() <= 1) {
623-
if (trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text)) !== $text) {
623+
if (trim(preg_replace("/(?:[\x09-\x0D\x20]{2,}+|[\x09-\x0D])/", ' ', $text)) !== $text) {
624624
@trigger_error(sprintf('"%s()" will normalize whitespaces by default in Symfony 5.0, set the second "$normalizeWhitespace" argument to false to retrieve the non-normalized version of the text.', __METHOD__), \E_USER_DEPRECATED);
625625
}
626626

627627
return $text;
628628
}
629629

630630
if (\func_num_args() > 1 && func_get_arg(1)) {
631-
return trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text));
631+
return trim(preg_replace("/(?:[\x09-\x0D\x20]{2,}+|[\x09-\x0D])/", ' ', $text));
632632
}
633633

634634
return $text;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.