8000 [DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support by bronze1man · Pull Request #9323 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support #9323

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

Closed
wants to merge 3 commits into from

Conversation

bronze1man
Copy link
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #9321
License MIT
Doc PR n/a

This is solution 1 in #9321 (comment)

});
$tmpContent = @mb_convert_encoding($content, 'HTML-ENTITIES', $charset);

set_error_handler($previous);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

set_error_handler() lost error_types information in previous error handler....
I can not find solution about this problem..

Copy link
Member

Choose a reason for hiding this comment

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

you should sue restore_error_handler instead of set_error_handler($previous)

$content = mb_convert_encoding($content, 'HTML-ENTITIES', $charset);
if (function_exists('mb_convert_encoding')) {
$hasError = false;
set_error_handler(function()use(&$hasError){
Copy link
Member

Choose a reason for hiding this comment

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

should be set_error_handler(function () use (&$hasError) {

fabpot added a commit that referenced this pull request Dec 29, 2013
…ing support (bronze1man)

This PR was submitted for the 2.2 branch but it was merged into the 2.3 branch instead (closes #9323).

Discussion
----------

[DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |  #9321
| License       | MIT
| Doc PR        | n/a

This is solution 1 in #9321 (comment)

Commits
-------

30af288 fix some cs
9f20b24 use restore_error_handler instead of set_error_handler($previous)
53cb6ad [DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support
@fabpot fabpot closed this Dec 29, 2013
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
0