diff --git a/src/Symfony/Component/Debug/Debug.php b/src/Symfony/Component/Debug/Debug.php index f8d2beaa065ba..e26810cb1ed8d 100644 --- a/src/Symfony/Component/Debug/Debug.php +++ b/src/Symfony/Component/Debug/Debug.php @@ -31,7 +31,7 @@ class Debug * @param int $errorReportingLevel The level of error reporting you want * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) */ - public static function enable($errorReportingLevel = null, $displayErrors = true) + public static function enable($errorReportingLevel = E_ALL, $displayErrors = true) { if (static::$enabled) { return; @@ -42,7 +42,7 @@ public static function enable($errorReportingLevel = null, $displayErrors = true if (null !== $errorReportingLevel) { error_reporting($errorReportingLevel); } else { - error_reporting(-1); + error_reporting(E_ALL); } if ('cli' !== php_sapi_name()) { diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 5f31aa4df618b..0725687c7b6c8 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -113,8 +113,6 @@ public static function register(self $handler = null, $replace = true) register_shutdown_function(__CLASS__.'::handleFatalError'); } - $levels = -1; - if ($handlerIsNew = null === $handler) { $handler = new static(); } @@ -131,7 +129,7 @@ public static function register(self $handler = null, $replace = true) restore_error_handler(); } - $handler->throwAt($levels & $handler->thrownErrors, true); + $handler->throwAt(E_ALL & $handler->thrownErrors, true); return $handler; } @@ -151,7 +149,7 @@ public function __construct(BufferingLogger $bootstrappingLogger = null) * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants * @param bool $replace Whether to replace or not any existing logger */ - public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false) + public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) { $loggers = array(); @@ -163,7 +161,7 @@ public function setDefaultLogger(LoggerInterface $logger, $levels = null, $repla } } else { if (null === $levels) { - $levels = E_ALL | E_STRICT; + $levels = E_ALL; } foreach ($this->loggers as $type => $log) { if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) { @@ -255,7 +253,7 @@ public function setExceptionHandler(callable $handler = null) public function throwAt($levels, $replace = false) { $prev = $this->thrownErrors; - $this->thrownErrors = (E_ALL | E_STRICT) & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; + $this->thrownErrors = E_ALL & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; if (!$replace) { $this->thrownErrors |= $prev; } diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php index 9a15e878a65e4..7b5e2b501f45d 100644 --- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php @@ -26,7 +26,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->errorReporting = error_reporting(E_ALL | E_STRICT); + $this->errorReporting = error_reporting(E_ALL); $this->loader = new ClassLoader(); spl_autoload_register(array($this->loader, 'loadClass'), true, true); DebugClassLoader::enable(); diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 33a543819d08d..878e349db78b8 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -45,12 +45,12 @@ class DebugHandlersListener implements EventSubscriberInterface * @param bool $scream Enables/disables screaming mode, where even silenced errors are logged * @param string $fileLinkFormat The format for links to source files */ - public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = null, $throwAt = -1, $scream = true, $fileLinkFormat = null) + public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null) { $this->exceptionHandler = $exceptionHandler; $this->logger = $logger; - $this->levels = $levels; - $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? -1 : null)); + $this->levels = null === $levels ? E_ALL : $levels; + $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null)); $this->scream = (bool) $scream; $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); } @@ -79,7 +79,7 @@ public function configure(Event $event = null) $scream |= $type; } } else { - $scream = null === $this->levels ? E_ALL | E_STRICT : $this->levels; + $scream = $this->levels; } if ($this->scream) { $handler->screamAt($scream);