Skip to content

Commit

Permalink
bug #36259 [DomCrawler] Fix BC break in assertions breaking Panther (…
Browse files Browse the repository at this point in the history
…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
-------

7af07c8 [DomCrawler] Fix BC break in assertions breaking Panther
  • Loading branch information
nicolas-grekas committed Mar 30, 2020
2 parents b580dd8 + 7af07c8 commit ff2c362
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -45,7 +45,7 @@ protected function matches($crawler): bool
return false;
}

return false !== mb_strpos($crawler->text(null, false), $this->expectedText);
return false !== mb_strpos($crawler->text(null, true), $this->expectedText);
}

/**
Expand Down
Expand Up @@ -45,7 +45,7 @@ protected function matches($crawler): bool
return false;
}

return $this->expectedText === trim($crawler->text(null, false));
return $this->expectedText === trim($crawler->text(null, true));
}

/**
Expand Down

0 comments on commit ff2c362

Please sign in to comment.