From 5e8071723007c9661cbee1398dbb46d530d3f5c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 27 Jul 2022 18:05:11 +0200 Subject: [PATCH] Workaround disabled "var_dump" --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- src/Symfony/Component/Debug/ErrorHandler.php | 6 +++--- src/Symfony/Component/ErrorHandler/ErrorHandler.php | 6 +++--- src/Symfony/Component/HttpClient/HttpClientTrait.php | 2 +- .../HttpKernel/EventListener/DebugHandlersListener.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 00fb4bc8a2433..68d8d8e339590 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -196,7 +196,7 @@ public function shutdown() if (class_exists(DebugClassLoader::class, false)) { DebugClassLoader::checkClasses(); } - $currErrorHandler = set_error_handler('var_dump'); + $currErrorHandler = set_error_handler('is_int'); restore_error_handler(); if ($currErrorHandler !== [$this, 'handleError']) { diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 99791f9aad9f3..67f526dcc3726 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -355,7 +355,7 @@ public function screamAt($levels, $replace = false) private function reRegister(int $prev) { if ($prev !== $this->thrownErrors | $this->loggedErrors) { - $handler = set_error_handler('var_dump'); + $handler = set_error_handler('is_int'); $handler = \is_array($handler) ? $handler[0] : null; restore_error_handler(); if ($handler === $this) { @@ -490,7 +490,7 @@ public function handleError($type, $message, $file, $line) $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(); } @@ -601,7 +601,7 @@ public static function handleFatalError(array $error = null) $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) { diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php index ceadcaf674fc6..c4fa829bc35da 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php @@ -375,7 +375,7 @@ public function screamAt(int $levels, bool $replace = false): int private function reRegister(int $prev): void { if ($prev !== $this->thrownErrors | $this->loggedErrors) { - $handler = set_error_handler('var_dump'); + $handler = set_error_handler('is_int'); $handler = \is_array($handler) ? $handler[0] : null; restore_error_handler(); if ($handler === $this) { @@ -522,7 +522,7 @@ public function handleError(int $type, string $message, string $file, int $line) $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(); } @@ -639,7 +639,7 @@ public static function handleFatalError(array $error = null): void $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) { diff --git a/src/Symfony/Component/HttpClient/HttpClientTrait.php b/src/Symfony/Component/HttpClient/HttpClientTrait.php index 536d93d84b2ef..8b6d35ed7131b 100644 --- a/src/Symfony/Component/HttpClient/HttpClientTrait.php +++ b/src/Symfony/Component/HttpClient/HttpClientTrait.php @@ -106,7 +106,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt } // Validate on_progress - if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) { + if (isset($options['on_progress']) && !\is_callable($onProgress = $options['on_progress'])) { throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress))); } diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 5027bd11698dd..6563487f36107 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -54,7 +54,7 @@ class DebugHandlersListener implements EventSubscriberInterface */ public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true) { - $handler = set_exception_handler('var_dump'); + $handler = set_exception_handler('is_int'); $this->earlyHandler = \is_array($handler) ? $handler[0] : null; restore_exception_handler(); @@ -80,7 +80,7 @@ public function configure(Event $event = null) } $this->firstCall = $this->hasTerminatedWithException = false; - $handler = set_exception_handler('var_dump'); + $handler = set_exception_handler('is_int'); $handler = \is_array($handler) ? $handler[0] : null; restore_exception_handler();