php-fig / container

MIT License
9.95k stars 53 forks source link

Fatal error with v1.1.0 and PHP 7.2 / 7.3 #30

Closed axzx closed 3 years ago

axzx commented 3 years ago

upgrade to version 1.1 broken many sites:(


Edit by @mnapoli

Here is the exception message:

PHP Fatal error: Class Symfony\Component\DependencyInjection\Exception\ExceptionInterface cannot implement previously implemented interface Throwable in vendor/symfony/dependency-injection/Exception/ExceptionInterface.php on line 22

tinogo commented 3 years ago

After updating the psr/container package to version 1.1.0 I'm getting this error too.

Fixed it by extending the require section of my composer.json with...

    "psr/container": "~1.0.0",

...and running composer update (resp. composer update psr/container) afterwards.

(or use the solution from @mynameisbogdan, which should be even better suited for this).

mynameisbogdan commented 3 years ago

We'll have to add a conflict rule to composer.json

{
    "conflict": {
        "psr/container": "1.1"
    }
}
akinspe commented 3 years ago

This totally breaks symphony. I don't understand why this was added as a 1.1.0. It should have been 2.0

mnapoli commented 3 years ago

As @Ocramius pointed, this bug is fixed in PHP 7.4:

https://github.com/php-fig/container/pull/20#discussion_r588445994

https://3v4l.org/vUsLI

That means that v1.1.0 is currently:

1: We probably need a 1.1.1 that solves the problem for PHP 7.2 & 7.3, we should probably revert the change and tag.

2: Then we have the possibility to re-introduce the change + up the PHP version requirement to PHP 7.4.

Does 2 make sense?

moufmouf commented 3 years ago

@mnapoli :+1:

(2) makes a lot of sense (but we can test it quietly later... not a Friday night :D )

axzx commented 3 years ago

@mnapoli +1

(2) makes a lot of sense (but we can test it quietly later... not a Friday night :D )

Friday after 4 p.m. is the best time to put the code on production :)

derrabus commented 3 years ago

2: Then we have the possibility to re-introduce the change + up the PHP version requirement to PHP 7.4.

Does 2 make sense?

I don't think this is necessary. The change would be reintroduced with 2.0.0 anyway.

Ocramius commented 3 years ago

No real need for 2.0.0:

derrabus commented 3 years ago

No real need for 2.0.0:

A 2.0.0 has already been tagged, with added return type declarations.

moufmouf commented 3 years ago

And 2.0.0 is targetting PHP 7.2+ so is potentially having the same issue.

See #32 regarding a discussion on what could be done regarding 2.0.0

derrabus commented 3 years ago

Thank you for reacting so quickly and releasing version 1.1.1! ❤️

Jean85 commented 3 years ago

Thank you for the really fast fix!

I'll take care of highlightin this pitfall in the evolution bylaw to avoid repeating the same error in the future.

Also, I agree with the plan for 1.1.2, totally makes sense.

Jean85 commented 3 years ago

This is fixed for 1.x in 1.1.1.

I'll leave this open until it's fixed in 2.0.