• brndnl0

    (@brndnl0)


    CrowdSec plugin seems to causes a fatal error when on an install with other plugins using Symfony components that don’t have namespace isolation (of which Crowdsec also does not I think?)

    Fatal error: Declaration of Symfony\Component\Cache\CacheItem::get() must be compatible with Psr\Cache\CacheItemInterface::get(): mixed

    The particular plugin causing this for me is MainWP Google Analytics Extension v6.0, I’ve created a Github issue with them here which goes into more detail.

    Thanks in advance for any help

Viewing 1 replies (of 1 total)
  • Hi @brndnl0 , thanks for creating this issue.

    I was able to install the MainWP plugin (v6), but, unfortunately, the Google Analytics plugin is a paid add-on.

    As you’ve mentioned, there is probably a class conflict between the 2 plugins because both of them don’t have namespace isolation.

    CrowdSec plugin bundles:

    • psr/cache v1.0 — where CacheItemInterface::get() has no PHP return type (public function get();)
    • symfony/cache v5.4.40 — where CacheItem::get() also has no return type (public function get()) — this is compatible with psr/cache v1.0

    The MainWP Google Analytics Extension v6.0 likely bundles:

    • psr/cache v3.0 — where the interface declares public function get(): mixed; (with an actual PHP 8.0+ return type)


    This could happen with any plugin that bundles some Symfony components with a different version.

    (Just a note: If we update our component to psr/cache v3.0, it will drop our support for PHP 7.X and this is not something our users are ready for)

    That’s why the best way to solve this , as you’ve already mentioned too, would be to use PHP-Scoper to prefix all vendor namespaces.

    As it is a decent amount of work, I’m not sure we’ll be able to work on this soon.

    I’ve created an issue in the GitHub repository so that we can track this issue (Pull Requests are welcome).

    Thanks again

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.