mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/17176] Use symfony error handler instead of debug
PHPBB3-17176
This commit is contained in:
@@ -13,14 +13,13 @@
|
||||
|
||||
namespace phpbb\debug;
|
||||
|
||||
use Symfony\Component\Debug\BufferingLogger;
|
||||
use Symfony\Component\Debug\DebugClassLoader;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
use Symfony\Component\ErrorHandler\BufferingLogger;
|
||||
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
|
||||
/**
|
||||
* Registers all the debug tools.
|
||||
|
||||
* @see Symfony\Component\Debug\Debug
|
||||
* @see \Symfony\Component\ErrorHandler\Debug
|
||||
*/
|
||||
class debug
|
||||
{
|
||||
@@ -34,10 +33,10 @@ class debug
|
||||
* If the Symfony ClassLoader component is available, a special
|
||||
* class loader is also registered.
|
||||
*
|
||||
* @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)
|
||||
* @param int|null $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(?int $errorReportingLevel = null, bool $displayErrors = true): void
|
||||
{
|
||||
if (static::$enabled)
|
||||
{
|
||||
@@ -58,7 +57,7 @@ class debug
|
||||
if ('cli' !== php_sapi_name())
|
||||
{
|
||||
ini_set('display_errors', 0);
|
||||
ExceptionHandler::register();
|
||||
ErrorHandler::register();
|
||||
}
|
||||
else if ($displayErrors && (!ini_get('log_errors') || ini_get('error_log')))
|
||||
{
|
||||
@@ -75,6 +74,6 @@ class debug
|
||||
error_handler::register()->throwAt(0, true);
|
||||
}
|
||||
|
||||
DebugClassLoader::enable();
|
||||
Debug::enable();
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace phpbb\debug;
|
||||
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
|
||||
/**
|
||||
* @psalm-suppress InvalidExtendClass
|
||||
@@ -23,7 +23,7 @@ class error_handler extends ErrorHandler
|
||||
/**
|
||||
* @psalm-suppress MethodSignatureMismatch
|
||||
*/
|
||||
public function handleError($type, $message, $file, $line)
|
||||
public function handleError(int $type, string $message, string $file, int $line): bool
|
||||
{
|
||||
if ($type === E_USER_WARNING || $type === E_USER_NOTICE)
|
||||
{
|
||||
|
Reference in New Issue
Block a user