Skip to content

[DomCrawler] Catch expected ValueError #36906

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

Merged
merged 1 commit into from
May 23, 2020

Conversation

derrabus
Copy link
Member

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #36872
License MIT
Doc PR N/A

mb_convert_encoding() raises a ValueError on php 8 if an unknown character set is passed. This causes trouble with the whole test suite because the temporary error handler is not deregistered in that case.

Since the previously raised warning was actively ignored by that error handler, I'm now ignoring the ValueError as well. Also, I've wrapped the restore_error_handler() call into a finally statement to make the whole construct a bit more robust.

@derrabus derrabus force-pushed the bugfix/dom-crawler-value-error branch from 4eb13be to b1db137 Compare May 22, 2020 19:35
@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 475a715 into symfony:3.4 May 23, 2020
nicolas-grekas added a commit that referenced this pull request May 23, 2020
This PR was merged into the 4.4 branch.

Discussion
----------

[DomCrawler] Catch expected ValueError

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #36872
| License       | MIT
| Doc PR        | N/A

This is #36906 ported to the 4.4 branch.

Commits
-------

32691e5 [DomCrawler] Catch expected ValueError.
@derrabus derrabus deleted the bugfix/dom-crawler-value-error branch May 23, 2020 07:38
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.

3 participants