Skip to content

Commit b00d988

Browse files
committed
bug symfony#32760 [HttpKernel] clarify error handler restoring process (xabbuh)
This PR was merged into the 4.2 branch. Discussion ---------- [HttpKernel] clarify error handler restoring process | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#32758 | License | MIT | Doc PR | Commits ------- c1349d1 clarify error handler restoring process
2 parents 5acd99c + c1349d1 commit b00d988

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ public function enableOnlyOptionalWarmers()
5050
*/
5151
public function warmUp($cacheDir)
5252
{
53-
if ($this->debug) {
53+
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
5454
$collectedLogs = [];
55-
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
56-
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
55+
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
5756
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
5857
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
5958
}
@@ -96,7 +95,7 @@ public function warmUp($cacheDir)
9695
$warmer->warmUp($cacheDir);
9796
}
9897
} finally {
99-
if ($this->debug && true !== $previousHandler) {
98+
if ($collectDeprecations) {
10099
restore_error_handler();
101100

102101
if (file_exists($this->deprecationLogsFilepath)) {

0 commit comments

Comments
 (0)