Skip to content

Commit 81b6e75

Browse files
committed
Fix PHP5
1 parent 872c41a commit 81b6e75

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,18 @@ 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+
// This can be registered before the PHPUnit error handler.
255+
if (!$previousErrorHandler) {
256+
$ErrorHandler = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_ErrorHandler' : 'PHPUnit\Util\ErrorHandler';
257+
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
258+
}
259+
else {
260+
return $previousErrorHandler($type, $msg, $file, $line, $context);
261+
}
262+
255263
}
256264
$deprecations[] = array(error_reporting(), $msg);
257265
});
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-
}
263266

264267
register_shutdown_function(function () use ($outputFile, &$deprecations) {
265268
file_put_contents($outputFile, serialize($deprecations));

0 commit comments

Comments
 (0)