Skip to content

Commit 8e74cfa

Browse files
feature #14181 [Debug] Updated the default log level when a PHP error occurs (lyrixx)
This PR was merged into the 2.7 branch. Discussion ---------- [Debug] Updated the default log level when a PHP error occurs | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ According to https://github.com/Seldaek/monolog#log-levels the level `NOTICE` means "Normal but significant events". So when a PHP notice occurs, it's not a "normal" event, but an error. That's why all PHP errors should use at least the `WARNING` error level. Commits ------- d2f85ed [Debug] Updated the default log level when a PHP error occurs
2 parents ce3b8fd + d2f85ed commit 8e74cfa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ class ErrorHandler
7171
private $loggers = array(
7272
E_DEPRECATED => array(null, LogLevel::INFO),
7373
E_USER_DEPRECATED => array(null, LogLevel::INFO),
74-
E_NOTICE => array(null, LogLevel::NOTICE),
75-
E_USER_NOTICE => array(null, LogLevel::NOTICE),
76-
E_STRICT => array(null, LogLevel::NOTICE),
74+
E_NOTICE => array(null, LogLevel::WARNING),
75+
E_USER_NOTICE => array(null, LogLevel::WARNING),
76+
E_STRICT => array(null, LogLevel::WARNING),
7777
E_WARNING => array(null, LogLevel::WARNING),
7878
E_USER_WARNING => array(null, LogLevel::WARNING),
7979
E_COMPILE_WARNING => array(null, LogLevel::WARNING),

src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ public function testDefaultLogger()
141141
$loggers = array(
142142
E_DEPRECATED => array(null, LogLevel::INFO),
143143
E_USER_DEPRECATED => array(null, LogLevel::INFO),
144-
E_NOTICE => array($logger, LogLevel::NOTICE),
144+
E_NOTICE => array($logger, LogLevel::WARNING),
145145
E_USER_NOTICE => array($logger, LogLevel::CRITICAL),
146-
E_STRICT => array(null, LogLevel::NOTICE),
146+
E_STRICT => array(null, LogLevel::WARNING),
147147
E_WARNING => array(null, LogLevel::WARNING),
148148
E_USER_WARNING => array(null, LogLevel::WARNING),
149149
E_COMPILE_WARNING => array(null, LogLevel::WARNING),

0 commit comments

Comments
 (0)