Skip to content
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

[Messenger] Fix support for Redis Sentinel using php-redis 6.0.0 #52629

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

pepeh
Copy link
Contributor

@pepeh pepeh commented Nov 17, 2023

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #52487
License MIT

Added support for php-redis 6.0.0 to Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.
A similar fix was done for RedisTrait before: #51683

@@ -94,7 +94,21 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster $redis =
} else {
if (null !== $sentinelMaster) {
$sentinelClass = \extension_loaded('redis') ? \RedisSentinel::class : Sentinel::class;
$sentinelClient = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);

if (version_compare(phpversion('redis'), '6.0.0', '>=')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (version_compare(phpversion('redis'), '6.0.0', '>=')) {
if (\extension_loaded('redis') && version_compare(phpversion('redis'), '6.0.0', '>=')) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a something similar to do for Relay? /cc @tillkruss @michael-grunder.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. As of Relay v0.6.8 we support both (PhpRedis 5.x and 6.x) constructors.

So you could do the same check for Relay, simply to future proof it. I don't think we'll drop support for the 5.x-style constructor anytime soon, tho.

Copy link

@tillkruss tillkruss Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas: There was another breaking change in PhpRedis 6.0 that I discovered randomly last week that can easily slip through the cracks and is hard to test for regarding flushdb() and flushall().

In PhpRedis 5.x flushdb(true) will trigger FLUSHDB ASYNC, while in PhpRedis 6.x flushdb(false) will trigger FLUSHDB ASYNC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reversing the meaning of a boolean parameter is quite bad as BC break as it is not discoverable at all 😢

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's bad for end users indeed...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, and not even marking it as a BC in the release notes. I've complained to Michael and Pavlo about this. I discovered this by pure luck.

@nicolas-grekas nicolas-grekas merged commit 43a1fa1 into symfony:6.3 Nov 21, 2023
0 of 2 checks passed
This was referenced Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants