shivammathur / setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
https://setup-php.com
MIT License
2.85k stars 334 forks source link

deprecation warnings not emitted #827

Closed staabm closed 4 months ago

staabm commented 4 months ago

Describe the bug

In CI no deprecation warnings are emitted per default

Version

Runners

Operating systems

ubuntu-latest

PHP versions

8.x

To Reproduce

Expected behavior

php should emit a deprecation warning and the pipeline should fail with

There was 1 error:

1) PhpParser\PrettyPrinterTest::testFormatPreservingPrint with data set "home/runner/work/PHP-Parser/PHP-Parser/test/code/formatPreservation/emptyListInsertion.test#2" ('Inserting into an empty list ....test)', '<?php\nfoo\n();\n\n$foo->\nba...oo {};', '$stmts[0]->expr->args[] = new...('b');', '<?php\nfoo\n($a, $b);\n\n$foo...oo {};', null)
Optional parameter $extends declared before required parameter $attributes is implicitly treated as a required parameter

/home/runner/work/PHP-Parser/PHP-Parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php:33
/home/runner/work/PHP-Parser/PHP-Parser/lib/PhpParser/PrettyPrinterAbstract.php:542
/home/runner/work/PHP-Parser/PHP-Parser/lib/PhpParser/PrettyPrinterAbstract.php:672
/home/runner/work/PHP-Parser/PHP-Parser/lib/PhpParser/PrettyPrinterAbstract.php:900
/home/runner/work/PHP-Parser/PHP-Parser/lib/PhpParser/PrettyPrinterAbstract.php:494
/home/runner/work/PHP-Parser/PHP-Parser/test/PhpParser/PrettyPrinterTest.php:249

to make the CI fail I had to add E_ALL error level manually, which I expected to be the default

without my fix it just did not emit the deprecation warning and unexpectedly succeeded

shivammathur commented 4 months ago

@staabm Yes, by default it is using the production php.ini. I cannot change it without a major version bump, so this will change in v3.

Till then, you can use the ini-file file input and set it to development for better defaults for a CI environment. https://github.com/shivammathur/setup-php#ini-file-optional

staabm commented 4 months ago

ohh nice, thank you.

I am a long time user of this great action and never realised.. maybe it needs to be more prominent in the README?