ddev and old packages/PHP extensions

The newest redis PHP extension is unfortunately not compatible with older Shopware versions, showing an error like this:

[2025-01-14T18:16:51.022048+00:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Compile Error: Declaration of Symfony\Component\Cache\Traits\Redis6Proxy::hSet($key, $member, $value): Redis|int|false must be compatible with Redis::hSet(string $key, mixed ...$fields_and_vals): Redis|int|false" at Redis6Proxy.php line 519 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Declaration of Symfony\\Component\\Cache\\Traits\\Redis6Proxy::hSet($key, $member, $value): Redis|int|false must be compatible with Redis::hSet(string $key, mixed ...$fields_and_vals): Redis|int|false at /var/www/html/vendor/symfony/cache/Traits/Redis6Proxy.php:519)"} []
[2025-01-14T18:16:51.022629+00:00] php.CRITICAL: Uncaught Error: Class "Symfony\Component\Cache\Traits\RedisProxy" not found {"exception":"[object] (Error(code: 0): Class \"Symfony\\Component\\Cache\\Traits\\RedisProxy\" not found at /var/www/html/vendor/symfony/cache/Traits/RedisTrait.php:320)"} []

The current ddev version is installing it. And to have a lower version we can just set the package in config.yaml:

webimage_extra_packages:
  - "php${DDEV_PHP_VERSION}-redis=5.3.7+4.3.0-3"

Unfortunately apt-get which is running in the background of ddev inside the container doesn’t allow to downgrade a package. To allow this there is a flag --allow-downgrades, thankfully ddev allows this as a package as well, so this fixes the problem:

webimage_extra_packages:
  - "php${DDEV_PHP_VERSION}-redis=5.3.7+4.3.0-3"
  - "--allow-downgrades"

And the site loads again <3

One thought on “ddev and old packages/PHP extensions

Leave a Reply