bug #31872 [Messenger] Add missing runtime check for ext redis version (chalasr)
This PR was merged into the 4.3 branch.
Discussion
----------
[Messenger] Add missing runtime check for ext redis version
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31791
| License | MIT
| Doc PR | n/a
Lower versions lead to segmentation faults.
Commits
-------
07603da06c
[Messenger] Add runtime check for ext redis version
This commit is contained in:
commit
a6b306d4f8
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Messenger\Transport\RedisExt;
|
||||
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Messenger\Exception\LogicException;
|
||||
use Symfony\Component\Messenger\Exception\TransportException;
|
||||
|
||||
/**
|
||||
@ -43,6 +44,10 @@ class Connection
|
||||
|
||||
public function __construct(array $configuration, array $connectionCredentials = [], array $redisOptions = [], \Redis $redis = null)
|
||||
{
|
||||
if (version_compare(phpversion('redis'), '4.3.0', '<')) {
|
||||
throw new LogicException('The redis transport requires php-redis 4.3.0 or higher.');
|
||||
}
|
||||
|
||||
$this->connection = $redis ?: new \Redis();
|
||||
$this->connection->connect($connectionCredentials['host'] ?? '127.0.0.1', $connectionCredentials['port'] ?? 6379);
|
||||
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
|
||||
|
Reference in New Issue
Block a user