-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Closed
Copy link
Description
Symfony version(s) affected
since 6.3.0
Description
RedisTrait::createConnection() fails when relay extension is enabled and redis extension is disabled and predis/predis package is not present.
How to reproduce
php-redis extension disabled.
predis/predis package not installed.
php-relay extension enabled.
// test.php
use Symfony\Component\Cache\Adapter\RedisAdapter;
$redisClient = RedisAdapter::createConnection('redis://redis-host:6379');
Result:
Symfony\Component\Cache\Exception\CacheException: Cannot find the "redis" extension nor the "predis/predis" package.
Possible Solution
Change Symfony\Component\Cache\Traits\RedisTrait.php line 101:
if (!\extension_loaded('redis') && !class_exists(\Predis\Client::class)) {
throw new CacheException('Cannot find the "redis" extension nor the "predis/predis" package.');
}
to:
if (!\extension_loaded('redis') && !\extension_loaded('relay') && !class_exists(\Predis\Client::class)) {
throw new CacheException('Cannot find the "redis", "relay" extensions nor the "predis/predis" package.');
}
Additional Context
No response