cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

Fatal Error: Declaration of Pimple\\Psr11\\ServiceLocator #178

Open ablears opened 2 years ago

ablears commented 2 years ago

composer require cedaro/satispress:1.0.3 results in the following:

Problem 1

  • Root composer.json requires cedaro/satispress 1.0.3 -> satisfiable by cedaro/satispress[v1.0.3].
  • cedaro/satispress v1.0.3 requires psr/container ^1.0 -> found psr/container[1.0.0, 1.1.0, 1.1.1, 1.1.2] but the package is fixed to 2.0.2

composer require cedaro/satispress:1.0.3 -W:

Lock file operations: 3 installs, 1 update, 0 removals

  • Locking cedaro/satispress (v1.0.3)
  • Locking cedaro/wp-plugin (v0.4.0)
  • Locking composer/semver (3.3.2)
  • Downgrading psr/container (2.0.2 => 1.1.2)

This then results in a fatal error:

PHP Fatal error: Declaration of Pimple\Psr11\ServiceLocator::get(string $id) must be compatible with Psr\Container\ContainerInterface::get($id) in /Users/admin/Sites/barltd/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php on line 59

thefrosty commented 2 years ago

This has been a common issue around different plugins that have been moving to the PHP >= 7.4 supported Psr Container ^2.0.x.

I have run into this issue in a few of my personal packages too. The only resolution is to have SatisPress bump it's depemdency to support PHP >= 7.4 and then update psr/container to ^2.0.2.

See changes: https://github.com/php-fig/container/compare/1.1.2...2.0.2

thefrosty commented 2 years ago

Funny, I ended up running into this issue again today with a project, and was able to resolve it via Composers use as feature. In my projects composer require I included: "psr/container": "dev-master as 1.1.2". This pulls in latest 2.0.x but tells your project it's version 1. Just be careful about strict type comparisons.

lirdis commented 2 years ago

Using Satispress on a regular wp site and getting this error... How exactly can I implement the suggested solution inside within the plugin files..? Currently have this error showing up: Fatal error: Declaration of Pimple\Psr11\ServiceLocator::get(string $id) must be compatible with Psr\Container\ContainerInterface::get($id) in /home/443710.cloudwaysapps.com/wxbfkrannf/public_html/wp-content/plugins/satispress/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php on line 38

The only way to get the website back up is to disable the plugin... But... I kinda need it :-) Will appreciate any idea anyone might have for me :)

lirdis commented 2 years ago

Anyone? Anything..??

alesub commented 1 year ago

I'm also having this issue after downloading the latest release and uploading it as a standard plugin.