[HttpKernel] Clarify error handler restoring process again
This commit is contained in:
parent
48859fd125
commit
4ee54f0e84
@ -597,10 +597,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debug) {
|
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
|
||||||
$collectedLogs = [];
|
$collectedLogs = [];
|
||||||
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
|
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
|
||||||
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
|
|
||||||
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
|
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
|
||||||
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
|
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
|
||||||
}
|
}
|
||||||
@ -636,7 +635,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
$container = $this->buildContainer();
|
$container = $this->buildContainer();
|
||||||
$container->compile();
|
$container->compile();
|
||||||
} finally {
|
} finally {
|
||||||
if ($this->debug && true !== $previousHandler) {
|
if ($collectDeprecations) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
|
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
|
||||||
|
Reference in New Issue
Block a user