mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/17176] Use symfony error handler instead of debug
PHPBB3-17176
This commit is contained in:
parent
043d7286e0
commit
5231e04d49
4 changed files with 12 additions and 82 deletions
|
@ -43,8 +43,8 @@
|
||||||
"s9e/text-formatter": "^2.0",
|
"s9e/text-formatter": "^2.0",
|
||||||
"symfony/config": "^6.3",
|
"symfony/config": "^6.3",
|
||||||
"symfony/console": "^6.3",
|
"symfony/console": "^6.3",
|
||||||
"symfony/debug": "~4.4",
|
|
||||||
"symfony/dependency-injection": "^6.3",
|
"symfony/dependency-injection": "^6.3",
|
||||||
|
"symfony/error-handler": "^6.3",
|
||||||
"symfony/event-dispatcher": "^6.3",
|
"symfony/event-dispatcher": "^6.3",
|
||||||
"symfony/filesystem": "^6.3",
|
"symfony/filesystem": "^6.3",
|
||||||
"symfony/finder": "^6.3",
|
"symfony/finder": "^6.3",
|
||||||
|
|
71
phpBB/composer.lock
generated
71
phpBB/composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "845ee61ff0e24697c187704eecc6a51f",
|
"content-hash": "0c305d521f2db3eec61dcef5b8359047",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bantu/ini-get-wrapper",
|
"name": "bantu/ini-get-wrapper",
|
||||||
|
@ -2847,75 +2847,6 @@
|
||||||
],
|
],
|
||||||
"time": "2023-08-16T10:10:12+00:00"
|
"time": "2023-08-16T10:10:12+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "symfony/debug",
|
|
||||||
"version": "v4.4.44",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/debug.git",
|
|
||||||
"reference": "1a692492190773c5310bc7877cb590c04c2f05be"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be",
|
|
||||||
"reference": "1a692492190773c5310bc7877cb590c04c2f05be",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1.3",
|
|
||||||
"psr/log": "^1|^2|^3"
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"symfony/http-kernel": "<3.4"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"symfony/http-kernel": "^3.4|^4.0|^5.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Component\\Debug\\": ""
|
|
||||||
},
|
|
||||||
"exclude-from-classmap": [
|
|
||||||
"/Tests/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Fabien Potencier",
|
|
||||||
"email": "fabien@symfony.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Provides tools to ease debugging PHP code",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/symfony/debug/tree/v4.4.44"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://symfony.com/sponsor",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/fabpot",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
|
||||||
"type": "tidelift"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"abandoned": "symfony/error-handler",
|
|
||||||
"time": "2022-07-28T16:29:46+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/dependency-injection",
|
"name": "symfony/dependency-injection",
|
||||||
"version": "v6.3.4",
|
"version": "v6.3.4",
|
||||||
|
|
|
@ -13,14 +13,13 @@
|
||||||
|
|
||||||
namespace phpbb\debug;
|
namespace phpbb\debug;
|
||||||
|
|
||||||
use Symfony\Component\Debug\BufferingLogger;
|
use Symfony\Component\ErrorHandler\BufferingLogger;
|
||||||
use Symfony\Component\Debug\DebugClassLoader;
|
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||||
use Symfony\Component\Debug\ExceptionHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers all the debug tools.
|
* Registers all the debug tools.
|
||||||
|
|
||||||
* @see Symfony\Component\Debug\Debug
|
* @see \Symfony\Component\ErrorHandler\Debug
|
||||||
*/
|
*/
|
||||||
class debug
|
class debug
|
||||||
{
|
{
|
||||||
|
@ -34,10 +33,10 @@ class debug
|
||||||
* If the Symfony ClassLoader component is available, a special
|
* If the Symfony ClassLoader component is available, a special
|
||||||
* class loader is also registered.
|
* class loader is also registered.
|
||||||
*
|
*
|
||||||
* @param int $errorReportingLevel The level of error reporting you want
|
* @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)
|
* @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)
|
if (static::$enabled)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +57,7 @@ class debug
|
||||||
if ('cli' !== php_sapi_name())
|
if ('cli' !== php_sapi_name())
|
||||||
{
|
{
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ExceptionHandler::register();
|
ErrorHandler::register();
|
||||||
}
|
}
|
||||||
else if ($displayErrors && (!ini_get('log_errors') || ini_get('error_log')))
|
else if ($displayErrors && (!ini_get('log_errors') || ini_get('error_log')))
|
||||||
{
|
{
|
||||||
|
@ -75,6 +74,6 @@ class debug
|
||||||
error_handler::register()->throwAt(0, true);
|
error_handler::register()->throwAt(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugClassLoader::enable();
|
Debug::enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\debug;
|
namespace phpbb\debug;
|
||||||
|
|
||||||
use Symfony\Component\Debug\ErrorHandler;
|
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @psalm-suppress InvalidExtendClass
|
* @psalm-suppress InvalidExtendClass
|
||||||
|
@ -23,7 +23,7 @@ class error_handler extends ErrorHandler
|
||||||
/**
|
/**
|
||||||
* @psalm-suppress MethodSignatureMismatch
|
* @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)
|
if ($type === E_USER_WARNING || $type === E_USER_NOTICE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue