Merge pull request #10346 from dzuelke/errorhandler-php81-compat
ErrorHandler PHP 8.1 compatibilitypull/10446/head
commit
da4d93759e
|
@ -10,6 +10,7 @@ require __DIR__.'/../src/bootstrap.php';
|
||||||
|
|
||||||
use Composer\Console\Application;
|
use Composer\Console\Application;
|
||||||
use Composer\XdebugHandler\XdebugHandler;
|
use Composer\XdebugHandler\XdebugHandler;
|
||||||
|
use Composer\Util\ErrorHandler;
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
@ -57,6 +58,8 @@ if (function_exists('ini_set')) {
|
||||||
|
|
||||||
putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
|
putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
|
||||||
|
|
||||||
|
ErrorHandler::register();
|
||||||
|
|
||||||
// run the command application
|
// run the command application
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->run();
|
$application->run();
|
||||||
|
|
|
@ -127,6 +127,8 @@ class Application extends BaseApplication
|
||||||
$io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
|
$io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
|
||||||
new QuestionHelper(),
|
new QuestionHelper(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
// Register error handler again to pass it the IO instance
|
||||||
ErrorHandler::register($io);
|
ErrorHandler::register($io);
|
||||||
|
|
||||||
if ($input->hasParameterOption('--no-cache')) {
|
if ($input->hasParameterOption('--no-cache')) {
|
||||||
|
|
|
@ -52,6 +52,15 @@ class ErrorHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$io) {
|
if (self::$io) {
|
||||||
|
// ignore symfony/* deprecation warnings about return types
|
||||||
|
// also ignore them from the Composer namespace, as 1.x won't get all that fixed anymore
|
||||||
|
if (preg_match('{^Return type of (Symfony|Composer)\\\\.*ReturnTypeWillChange}is', $message)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (strpos(strtr($file, '\\', '/'), 'vendor/symfony/') !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
|
self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
|
||||||
if (self::$io->isVerbose()) {
|
if (self::$io->isVerbose()) {
|
||||||
self::$io->writeError('<warning>Stack trace:</warning>');
|
self::$io->writeError('<warning>Stack trace:</warning>');
|
||||||
|
|
Loading…
Reference in New Issue