Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DomCrawler] prevent deprecation being triggered from assertion #35899

Merged
merged 1 commit into from Mar 2, 2020

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Feb 28, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #35889
License MIT
Doc PR

Copy link
Contributor

@fancyweb fancyweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh
Copy link
Member Author

xabbuh commented Mar 1, 2020

@fancyweb Indeed, I fixed it.

@fabpot
Copy link
Member

fabpot commented Mar 2, 2020

Thank you @xabbuh.

@fabpot fabpot merged commit 0936a4e into symfony:4.4 Mar 2, 2020
@xabbuh xabbuh deleted the issue-35889 branch March 2, 2020 12:27
This was referenced Mar 27, 2020
nicolas-grekas added a commit that referenced this pull request Mar 30, 2020
…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
@flaushi
Copy link

flaushi commented Apr 2, 2020

Maybe we could add a hint to assertSelectorTextSame into the error message

@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);
? I think many people had to research this issue

@xabbuh
Copy link
Member Author

xabbuh commented Apr 2, 2020

What issue would that solve?

@flaushi
Copy link

flaushi commented Apr 2, 2020

I can imagine may people using $crawler->text() in their tests.

They all have to read through this issue and PR to finally see that there is a new assertion assertSelectorTextSame they can use to prevent the deprecation error. Kind of "documentation in issue"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants