8000 bug #31872 [Messenger] Add missing runtime check for ext redis versio… · symfony/symfony@a6b306d · GitHub
[go: up one dir, main page]

Skip to content

Commit a6b306d

Browse files
committed
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 ------- 07603da [Messenger] Add runtime check for ext redis version
2 parents e901494 + 07603da commit a6b306d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Lines changed: 5 add B15A itions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Messenger\Transport\RedisExt;
1313

1414
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
15+
use Symfony\Component\Messenger\Exception\LogicException;
1516
use Symfony\Component\Messenger\Exception\TransportException;
1617

1718
/**
@@ -43,6 +44,10 @@ class Connection
4344

4445
public function __construct(array $configuration, array $connectionCredentials = [], array $redisOptions = [], \Redis $redis = null)
4546
{
47+
if (version_compare(phpversion('redis'), '4.3.0', '<')) {
48+
throw new LogicException('The redis transport requires php-redis 4.3.0 or higher.');
49+
}
50+
4651
$this->connection = $redis ?: new \Redis();
4752
$this->connection->connect($connectionCredentials['host'] ?? '127.0.0.1', $connectionCredentials['port'] ?? 6379);
4853
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);

0 commit comments

Comments
 (0)
0