Skip to content

Commit 627f373

Browse files
bug #59975 [HttpKernel] Only remove E_WARNING from error level during kernel init (fritzmg)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpKernel] Only remove `E_WARNING` from error level during kernel init | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #59139 | License | MIT This fixes #59139 as mentioned in #59139 (comment). With PHP 8.4 there can currently be a huge console output spam showing the > Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead deprecation, depending on your installed packages. This is caused by the kernel completely overriding the PHP error level within `initializeContainer()`, which will cause _everything_ to be shown (except warnings) that is triggered during `include`. The kernel should always adhere to the `error_reporting` level set by the environment - thus this PR fixes this issue by only removing the `E_WARNING` level from the `error_reporting` level when trying to silence the include failures while including the cache path during kernel init. Commits ------- 89818d9 Only remove E_WARNING from error level
2 parents c21e302 + 89818d9 commit 627f373

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ protected function initializeContainer()
407407
$cachePath = $cache->getPath();
408408

409409
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
410-
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
410+
$errorLevel = error_reporting();
411+
error_reporting($errorLevel & ~\E_WARNING);
411412

412413
try {
413414
if (is_file($cachePath) && \is_object($this->container = include $cachePath)

0 commit comments

Comments
 (0)