Skip to content

Commit

Permalink
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Crawler.php
Original file line number Diff line number Diff line change
@@ -620,15 +620,15 @@ public function text(/* string $default = null, bool $normalizeWhitespace = true
$text = $this->getNode(0)->nodeValue;

if (\func_num_args() <= 1) {
if (trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text)) !== $text) {
if (trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $text), " \n\r\t\x0C") !== $text) {
@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);
}

return $text;
}

if (\func_num_args() > 1 && func_get_arg(1)) {
return trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text));
return trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $text), " \n\r\t\x0C");
}

return $text;

0 comments on commit 4b8daf6

Please sign in to comment.