Aggiornato Composer
This commit is contained in:
38
vendor/symfony/error-handler/ErrorHandler.php
vendored
38
vendor/symfony/error-handler/ErrorHandler.php
vendored
@@ -108,7 +108,7 @@ class ErrorHandler
|
||||
/**
|
||||
* Registers the error handler.
|
||||
*/
|
||||
public static function register(self $handler = null, bool $replace = true): self
|
||||
public static function register(?self $handler = null, bool $replace = true): self
|
||||
{
|
||||
if (null === self::$reservedMemory) {
|
||||
self::$reservedMemory = str_repeat('x', 32768);
|
||||
@@ -181,7 +181,7 @@ class ErrorHandler
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct(BufferingLogger $bootstrappingLogger = null, bool $debug = false)
|
||||
public function __construct(?BufferingLogger $bootstrappingLogger = null, bool $debug = false)
|
||||
{
|
||||
if ($bootstrappingLogger) {
|
||||
$this->bootstrappingLogger = $bootstrappingLogger;
|
||||
@@ -380,8 +380,8 @@ class ErrorHandler
|
||||
*/
|
||||
private function reRegister(int $prev): void
|
||||
{
|
||||
if ($prev !== $this->thrownErrors | $this->loggedErrors) {
|
||||
$handler = set_error_handler('var_dump');
|
||||
if ($prev !== ($this->thrownErrors | $this->loggedErrors)) {
|
||||
$handler = set_error_handler('is_int');
|
||||
$handler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_error_handler();
|
||||
if ($handler === $this) {
|
||||
@@ -457,7 +457,7 @@ class ErrorHandler
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (false !== strpos($message, '@anonymous')) {
|
||||
if (PHP_VERSION_ID < 80303 && false !== strpos($message, '@anonymous')) {
|
||||
$backtrace = debug_backtrace(false, 5);
|
||||
|
||||
for ($i = 1; isset($backtrace[$i]); ++$i) {
|
||||
@@ -465,8 +465,7 @@ class ErrorHandler
|
||||
&& ('trigger_error' === $backtrace[$i]['function'] || 'user_error' === $backtrace[$i]['function'])
|
||||
) {
|
||||
if ($backtrace[$i]['args'][0] !== $message) {
|
||||
$message = $this->parseAnonymousClass($backtrace[$i]['args'][0]);
|
||||
$logMessage = $this->levels[$type].': '.$message;
|
||||
$message = $backtrace[$i]['args'][0];
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -474,6 +473,11 @@ class ErrorHandler
|
||||
}
|
||||
}
|
||||
|
||||
if (false !== strpos($message, "@anonymous\0")) {
|
||||
$message = $this->parseAnonymousClass($message);
|
||||
$logMessage = $this->levels[$type].': '.$message;
|
||||
}
|
||||
|
||||
$errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
|
||||
|
||||
if ($throw || $this->tracedErrors & $type) {
|
||||
@@ -513,7 +517,12 @@ class ErrorHandler
|
||||
}
|
||||
|
||||
// Display the original error message instead of the default one.
|
||||
$this->handleException($errorAsException);
|
||||
$exitCode = self::$exitCode;
|
||||
try {
|
||||
$this->handleException($errorAsException);
|
||||
} finally {
|
||||
self::$exitCode = $exitCode;
|
||||
}
|
||||
|
||||
// Stop the process by giving back the error to the native handler.
|
||||
return false;
|
||||
@@ -528,7 +537,7 @@ class ErrorHandler
|
||||
$log = 0;
|
||||
} else {
|
||||
if (\PHP_VERSION_ID < (\PHP_VERSION_ID < 70400 ? 70316 : 70404)) {
|
||||
$currentErrorHandler = set_error_handler('var_dump');
|
||||
$currentErrorHandler = set_error_handler('is_int');
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
@@ -633,7 +642,7 @@ class ErrorHandler
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function handleFatalError(array $error = null): void
|
||||
public static function handleFatalError(?array $error = null): void
|
||||
{
|
||||
if (null === self::$reservedMemory) {
|
||||
return;
|
||||
@@ -645,7 +654,7 @@ class ErrorHandler
|
||||
$sameHandlerLimit = 10;
|
||||
|
||||
while (!\is_array($handler) || !$handler[0] instanceof self) {
|
||||
$handler = set_exception_handler('var_dump');
|
||||
$handler = set_exception_handler('is_int');
|
||||
restore_exception_handler();
|
||||
|
||||
if (!$handler) {
|
||||
@@ -665,6 +674,10 @@ class ErrorHandler
|
||||
set_exception_handler($h);
|
||||
}
|
||||
if (!$handler) {
|
||||
if (null === $error && $exitCode = self::$exitCode) {
|
||||
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if ($handler !== $h) {
|
||||
@@ -700,8 +713,7 @@ class ErrorHandler
|
||||
// Ignore this re-throw
|
||||
}
|
||||
|
||||
if ($exit && self::$exitCode) {
|
||||
$exitCode = self::$exitCode;
|
||||
if ($exit && $exitCode = self::$exitCode) {
|
||||
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user