Skip to content

Commit e265f33

Browse files
bug #61658 [Messenger] map legacy options to the "sentinel" key when parsing DSNs (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [Messenger] map legacy options to the "sentinel" key when parsing DSNs | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #61590 | License | MIT Commits ------- c7cf542 map legacy options to the "sentinel" key when parsing DSNs
2 parents 9157094 + c7cf542 commit e265f33

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,21 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
260260
}, $paramss, $dsns);
261261
}
262262

263+
if (isset($options['sentinel']) && isset($options['redis_sentinel']) && $options['sentinel'] !== $options['redis_sentinel']) {
264+
throw new InvalidArgumentException('Cannot use both "sentinel" and "redis_sentinel" at the same time.');
265+
}
266+
267+
if (isset($options['sentinel']) && isset($options['sentinel_master']) && $options['sentinel'] !== $options['sentinel_master']) {
268+
throw new InvalidArgumentException('Cannot use both "sentinel" and "sentinel_master" at the same time.');
269+
}
270+
271+
if (isset($options['redis_sentinel']) && isset($options['sentinel_master']) && $options['redis_sentinel'] !== $options['sentinel_master']) {
272+
throw new InvalidArgumentException('Cannot use both "redis_sentinel" and "sentinel_master" at the same time.');
273+
}
274+
275+
$options['sentinel'] ??= $options['redis_sentinel'] ?? $options['sentinel_master'] ?? null;
276+
unset($options['redis_sentinel'], $options['sentinel_master']);
277+
263278
if ($invalidOptions = array_diff(array_keys($options), array_keys(self::DEFAULT_OPTIONS), ['host', 'port'])) {
264279
throw new LogicException(\sprintf('Invalid option(s) "%s" passed to the Redis Messenger transport.', implode('", "', $invalidOptions)));
265280
}

0 commit comments

Comments
 (0)