-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Redis6ProxyTrait incompatible with PhpRedis 6.1.0 interface #58886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which version of the Cache component do you have installed? |
This finding is from 6.4.11. |
This issue is mentioned in phpredis: phpredis/phpredis#2562 |
This is weird. 6.4.11 should be compatible with phpredis 6.1.0 as it includes the patch. the signature in 6.4.11 is compatible with the Redis signature (removing the parameter types is fine, as widening parameter types in a child class is allowed). Error message: For some reason, it looks like the second parameter is not variadic on the system in which you are getting the error. Please check that you are indeed using an unmodified 6.4.11 version. |
Okay, I did some researching to make this reproducible: Made this Docker file: FROM php:8.2-cli
RUN apt-get update && apt-get install -y \
unzip \
libzip-dev \
zip \
&& docker-php-ext-install zip
RUN apt-get update && apt-get install -y redis-server
RUN pecl install redis-6.1.0 \
&& docker-php-ext-enable redis
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY composer.json composer.json
COPY example.php example.php
RUN composer install
EXPOSE 6379
CMD ["sh", "-c", "service redis-server start && php example.php"] Include this
Then include this <?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Symfony\Component\Cache\Traits\Redis6Proxy;
$redisInstance = new Redis6Proxy();
$redisInstance->setKey('test_key', 'Hello, Redis with Redis6ProxyTrait!');
$value = $redisInstance->getKey('test_key');
var_dump($value); Then build the container and run it:
Then run it:
|
@HMAZonderland this does not work because |
@stof thanks! Noticed it was missing. I have included it now. |
OK, found it. The link you shared for the Symfony source code was not for 6.4.11 but for the latest 6.4 branch. So the solution for this is simple: update to 6.4.12 or newer, where the issue is already fixed. |
Aha, thanks! |
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
All using phpredis 6.1 and Redis6ProxyTrait
Description
In the phpredis 6.1.0 release the interface for hset is defined as:
The
Redis6ProxyTrait
trait implements this as:This triggers a Compile error:
How to reproduce
Possible Solution
Implement the phpredis interface correctly.
Additional Context
No response
The text was updated successfully, but these errors were encountered: