bug #36259 [DomCrawler] Fix BC break in assertions breaking Panther (dunglas)

This PR was merged into the 4.4 branch.

Discussion
----------

[DomCrawler] Fix BC break in assertions breaking Panther

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

#35899 introduces a BC break: browsers aren't able to retrieve the non-normalized version of a text. According to the HTML spec, whitespaces are always normalized. Because of this patch, these assertions doesn't work with Panther anymore.

Also, this change probably hurts other users because getting the non-normalized version is almost never expected. (I'm in favor of **not** supporting retrieving the non-normalized version at all, for consistency with browsers and the spec, but it's another topic).

Commits
-------

7af07c889e [DomCrawler] Fix BC break in assertions breaking Panther
This commit is contained in:
Nicolas Grekas 2020-03-30 12:16:58 +02:00
commit ff2c362195
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ final class CrawlerSelectorTextContains extends Constraint
return false;
}
return false !== mb_strpos($crawler->text(null, false), $this->expectedText);
return false !== mb_strpos($crawler->text(null, true), $this->expectedText);
}
/**

View File

@ -45,7 +45,7 @@ final class CrawlerSelectorTextSame extends Constraint
return false;
}
return $this->expectedText === trim($crawler->text(null, false));
return $this->expectedText === trim($crawler->text(null, true));
}
/**