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.91k stars 340 forks source link

Mass failure after Ubuntu upgrade #798

Closed iBotPeaches closed 10 months ago

iBotPeaches commented 10 months ago

Describe the bug

All our builds are failing now (Including Laravel) after this change: https://github.com/shivammathur/php-ubuntu/commit/83d1155cd11a0178b4d7431a0c91ed6c1b7454ad

It manifest as an error of

Error: Child process error (exit code 255): PHP Fatal error:  Declaration of Symfony\Component\Cache\CacheItem::expiresAt(?DateTimeInterface $expiration): static must be compatible with PsrExt\Cache\CacheItemInterface::expiresAt($expiration) in /home/runner/work/xxx-Laravel/xxx-Laravel/vendor/symfony/cache/CacheItem.php on line 65
PHP Fatal error:  Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with PsrExt\Log\LoggerInterface::emergency($message, array $context = []) in /home/runner/work/PinchAPenny-Laravel/PinchAPenny-Laravel/vendor/monolog/monolog/src/Monolog/Logger.php on line 681

Which I found is claimed as a "buggy" extension by Symfony: https://github.com/symfony/symfony/issues/49984

Version

Runners

Operating systems Ubuntu

PHP versions All

To Reproduce Run PHPStan?

Expected behavior Not a crash

Are you willing to submit a PR? I'd just revert this https://github.com/shivammathur/php-ubuntu/commit/83d1155cd11a0178b4d7431a0c91ed6c1b7454ad

stevebauman commented 10 months ago

Just started getting this too on all of my builds in GitHub actions.

ralphjsmit commented 10 months ago

Me too, all our GitHub Actions are crashing (in multiple repos).

mattwellss commented 10 months ago

While waiting for a fix, the psr extension can be disabled

Shared extensions can be disabled by prefixing them with a :. All extensions depending on the specified extension will also be disabled.

  steps:
    - uses: shivammathur/setup-php@[whatever]
      with:
        [other stuff]
        extensions: :psr

https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support

percymamedy commented 10 months ago

While waiting for a fix, the psr extension can be disabled

Shared extensions can be disabled by prefixing them with a :. All extensions depending on the specified extension will also be disabled.

  steps:
    - uses: shivammathur/setup-php@[whatever]
      with:
        [other stuff]
        extensions: :psr

https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support

That fix worked for me

jonerickson commented 10 months ago

Confirmed from Laravel staff in v10 you need to disable the psr extension.

https://github.com/laravel/framework/issues/46165

iBotPeaches commented 10 months ago

Sure - I can go fix a ton of builds with disabling psr. It isn't that urgent though if I hopefully believe in the morning - that the author will just revert this and things will resume.

As you can see this extension at the core is this outdated PECL extension - https://pecl.php.net/package/psr. This is leading to what we see here.

Screenshot 2023-12-06 at 4 50 55 PM

So I don't think it merits a default include in the image and should be "opt-in" only.

jwage commented 10 months ago

Ran in to this as well:

Uncaught Exception: InvalidArgumentException Could not get class storage for psr\log\loglevel
Emitted in /home/runner/work/traderspost/traderspost/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:46

Using GitHub actions with shivammathur/setup-php@v2

Ignoring :psr worked for me.