10000 use restore_error_handler instead of set_error_handler($previous) · symfony/symfony@461412c · GitHub
[go: up one dir, main page]

Skip to content

Commit 461412c

Browse files
bronze1manfabpot
authored andcommitted
use restore_error_handler instead of set_error_handler($previous)
1 parent acb2df0 commit 461412c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ public function addHtmlContent($content, $charset = 'UTF-8')
148148
$dom->validateOnParse = true;
149149

150150
if (function_exists('mb_convert_encoding')) {
151-
$has_error = false;
152-
$previous = set_error_handler(function()use(&$has_error){
153-
$has_error = true;
151+
$hasError = false;
152+
set_error_handler(function()use(&$hasError){
153+
$hasError = true;
154154
});
155155
$tmpContent = @mb_convert_encoding($content, 'HTML-ENTITIES', $charset);
156156

157-
set_error_handler($previous);
157+
restore_error_handler();
158158

159-
if (!$has_error) {
159+
if (!$hasError) {
160160
$content = $tmpContent;
161161
}
162162
}

0 commit comments

Comments
 (0)
0