llaville / php-compatinfo

Library that find out the minimum version and the extensions required for a piece of code to run
https://llaville.github.io/php-compatinfo/7.1/
Other
371 stars 21 forks source link

fix named parameters confusion with PHP 8 #282

Closed remicollet closed 3 years ago

remicollet commented 3 years ago

Without this fix:

PHP Fatal error:  Uncaught Error: Unknown named parameter $stop-on-failure in /work/GIT/php-compat-info/src/Bartlett/CompatInfo/Console/CommandFactory.php:320
Stack trace:
#0 /work/GIT/php-compat-info/src/Bartlett/CompatInfo/Console/CommandFactory.php(320): call_user_func_array()
#1 /work/GIT/php-compat-info/vendor/symfony/console/Command/Command.php(256): Bartlett\CompatInfo\Console\CommandFactory->Bartlett\CompatInfo\Console\{closure}()
#2 /work/GIT/php-compat-info/vendor/symfony/console/Application.php(938): Symfony\Component\Console\Command\Command->run()
#3 /work/GIT/php-compat-info/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand()
#4 /work/GIT/php-compat-info/src/Bartlett/CompatInfo/Console/Application.php(217): Symfony\Component\Console\Application->doRun()
#5 /work/GIT/php-compat-info/vendor/symfony/console/Application.php(142): Bartlett\CompatInfo\Console\Application->doRun()
#6 /work/GIT/php-compat-info/src/Bartlett/CompatInfo/Console/Application.php(192): Symfony\Component\Console\Application->run()
#7 /work/GIT/php-compat-info/bin/phpcompatinfo(27): Bartlett\CompatInfo\Console\Application->run()
#8 {main}
  thrown in /work/GIT/php-compat-info/src/Bartlett/CompatInfo/Console/CommandFactory.php on line 320

Fo the is_callable call, need to understand why syntax_only is now required

remicollet commented 3 years ago

is_callable change explanation:

is_callable fails when an object is not given (looks like he believes we are testing a static call), so checking with an object instead of class-name fixes this issue.

remicollet commented 3 years ago

And for completeness https://github.com/php/php-src/pull/6263

llaville commented 3 years ago

@remicollet we have the same issue on PHP Reflect 4.4.0; FYI I'm prepare a release 4.4.1 to fix it and allows PHP 8