Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e83d11b

Browse filesBrowse files
[HttpKernel] detect deprecations thrown by container initialization during tests
1 parent 50644d0 commit e83d11b
Copy full SHA for e83d11b

File tree

1 file changed

+3
-2
lines changed
Filter options

1 file changed

+3
-2
lines changed

‎src/Symfony/Component/HttpKernel/Kernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ protected function initializeContainer()
536536
if (!$cache->isFresh()) {
537537
if ($this->debug) {
538538
$collectedLogs = array();
539-
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
539+
$previousHandler = 6 < count(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 7));
540+
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
540541
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
541542
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
542543
}
@@ -572,7 +573,7 @@ protected function initializeContainer()
572573
$container = $this->buildContainer();
573574
$container->compile();
574575
} finally {
575-
if ($this->debug) {
576+
if ($this->debug && true !== $previousHandler) {
576577
restore_error_handler();
577578

578579
file_put_contents($this->getCacheDir().'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.