1
0
Fork 0

Suppress E_DEPRECATED for PHP 8.4 compatibility (#12217)

The E_STRICT constant is deprecated in PHP 8.4, and explicit nullable types are also advised with a deprecation notice.

As there are circumstances where people still have to run the 2.2 LTS with newer versions of PHP, we're now suppressing E_DEPRECATED.

Also see #12214
pull/12232/head
David Zülke 2024-12-10 10:19:44 -05:00 committed by GitHub
parent 2365b7842b
commit 3b27dc105c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,9 @@ use Composer\XdebugHandler\XdebugHandler;
use Composer\Util\Platform;
use Composer\Util\ErrorHandler;
error_reporting(-1);
// no E_DEPRECATED for this LTS series, or we get countless deprecation notices related to E_STRICT and explicit nullable types for PHP 8.4+
// also see ErrorHandler::register()
error_reporting(E_ALL & ~E_DEPRECATED);
// Restart without Xdebug
$xdebug = new XdebugHandler('Composer');

View File

@ -89,7 +89,9 @@ class ErrorHandler
public static function register(IOInterface $io = null)
{
set_error_handler(array(__CLASS__, 'handle'));
error_reporting(E_ALL | E_STRICT);
// no E_DEPRECATED for this LTS series, or we get countless deprecation notices related to E_STRICT and explicit nullable types for PHP 8.4+
// also see bin/composer
error_reporting(E_ALL & ~E_DEPRECATED | E_STRICT);
self::$io = $io;
}
}