Skip to content

Commit 7796b21

Browse files
bug symfony#54673 [Messenger] explicitly cast boolean SSL stream options (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [Messenger] explicitly cast boolean SSL stream options | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#51723 | License | MIT Commits ------- 6a1f08d explicitly cast boolean SSL stream options
2 parents 6b3407d + 6a1f08d commit 7796b21

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster|null $red
8888
throw new InvalidArgumentException('Cannot configure Redis Sentinel and Redis Cluster instance at the same time.');
8989
}
9090

91+
$booleanStreamOptions = [
92+
'allow_self_signed',
93+
'capture_peer_cert',
94+
'capture_peer_cert_chain',
95+
'disable_compression',
96+
'SNI_enabled',
97+
'verify_peer',
98+
'verify_peer_name',
99+
];
100+
101+
foreach ($options['ssl'] ?? [] as $streamOption => $value) {
102+
if (\in_array($streamOption, $booleanStreamOptions, true) && \is_string($value)) {
103+
$options['ssl'][$streamOption] = filter_var($value, \FILTER_VALIDATE_BOOL);
104+
}
105+
}
106+
91107
if ((\is_array($host) && null === $sentinelMaster) || $redis instanceof \RedisCluster) {
92108
$hosts = \is_string($host) ? [$host.':'.$port] : $host; // Always ensure we have an array
93109
$this->redis = static fn () => self::initializeRedisCluster($redis, $hosts, $auth, $options);

0 commit comments

Comments
 (0)