8000 bug #24681 Fix isolated error handling (alexpott) · symfony/symfony@107705a · GitHub
[go: up one dir, main page]

Skip to content

Commit 107705a

Browse files
bug #24681 Fix isolated error handling (alexpott)
This PR was squashed before being merged into the 3.3 branch (closes #24681). Discussion ---------- Fix isolated error handling | Q | A | ------------- | --- | Branch? | 3.3 <!-- see comment below --> | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the 3.4, legacy code removals go to the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Fixes \Symfony\Bridge\PhpUnit\Tests\ProcessIsolationTest on PHP5.5 and PHP5.6 and (probably) HHVM. Commits ------- b1a2205 Fix isolated error handling
2 parents e6d949b + b1a2205 commit 107705a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,16 @@ public static function collectDeprecations($outputFile)
251251
$deprecations = array();
252252
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, &$previousErrorHandler) {
253253
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
254-
return $previousErrorHandler ? $previousErrorHandler($type, $msg, $file, $line, $context) : false;
254+
if ($previousErrorHandler) {
255+
return $previousErrorHandler($type, $msg, $file, $line, $context);
256+
}
257+
258+
$ErrorHandler = class_exists('PHPUnit_Util_ErrorHandler', false) ? 'PHPUnit_Util_ErrorHandler' : 'PHPUnit\Util\ErrorHandler';
259+
260+
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
255261
}
256262
$deprecations[] = array(error_reporting(), $msg);
257263
});
258-
// This can be registered before the PHPUnit error handler.
259-
if (!$previousErrorHandler) {
260-
$UtilPrefix = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_' : 'PHPUnit\Util\\';
261-
$previousErrorHandler = $UtilPrefix.'ErrorHandler::handleError';
262-
}
263264

264265
register_shutdown_function(function () use ($outputFile, &$deprecations) {
265266
file_put_contents($outputFile, serialize($deprecations));

0 commit comments

Comments
 (0)
0