Error 500 - Redis6Proxy::hSet must be compatible with Redis::hSet

Error message

AH01071: Got error 'PHP message: PHP Fatal 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 in /var/www/vhosts/creoline-demo.com/httpdocs/vendor/symfony/cache/Traits/Redis6Proxy.php
on line 519'


The problem is caused by the latest PHP updates. Affected are PHP 8.1, 8.2 and 8.3. In the minor update for the phpredis integration, the method signature was adjusted. The Composer package symfony/cache used in Shopware is incompatible with this update and must be updated.



Troubleshooting

Solution 1)

Perform a Shopware update to version 6.6.4.0.


Source:

Shopware has updated the Symfony/cache package to the required version 7.1.1 in version 6.6.4.0.

https://github.com/shopware/shopware/blob/v6.6.4.0/composer.json


Solution 2)

If a Shopware update is not possible at the current time, the incompatible method signature can be corrected. To do this, open the file:

/var/www/vhosts/creoline-demo.com/httpdocs/vendor/symfony/cache/Traits/Redis6Proxy.php


and replace the hSet method as follows:

// Backup of the previous method:
//public function hSet($key, $member, $value): \Redis|false|int
//{
// return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
//}

// Implementation of the new hSet method:
public function hSet($key, ...$fields_and_vals): \Redis|false|int {
   return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
}


Alternatively you can also replace the file with our patch version via the file system:

https://dl.creoline.com/space/shopware-6-patches


Replace the Redis6Proxy.php file in the directory:

/var/www/vhosts/<your-domain.com>/httpdocs/vendor/symfony/cache/Traits/Redis6Proxy.php


The Redis connection will then work properly again.


If you still receive the error message despite the adjustment, please contact our support team.

Contact us