From 865886e5c5d8d0fe1877da967ae6c087993c0a26 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 24 May 2022 17:35:50 +0200 Subject: [PATCH] Always show deprecation notices even if silenced --- src/Composer/Util/ErrorHandler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/ErrorHandler.php b/src/Composer/Util/ErrorHandler.php index 80a0f9eed..5fa1a3dd3 100644 --- a/src/Composer/Util/ErrorHandler.php +++ b/src/Composer/Util/ErrorHandler.php @@ -38,8 +38,10 @@ class ErrorHandler */ public static function handle(int $level, string $message, string $file, int $line): bool { + $isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED; + // error code is not included in error_reporting - if (!(error_reporting() & $level)) { + if (!$isDeprecationNotice && !(error_reporting() & $level)) { return true; } @@ -48,7 +50,7 @@ class ErrorHandler "\na legitimately suppressed error that you were not supposed to see."; } - if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) { + if (!$isDeprecationNotice) { throw new \ErrorException($message, 0, $level, $file, $line); }