From 37e14085e07fa783f05ded3383d96dac9c858ad9 Mon Sep 17 00:00:00 2001 From: viktor Date: Tue, 22 Dec 2020 00:55:02 +0100 Subject: [PATCH 1/3] [Cache] Add TLS query parameter to Redis DSN --- src/Symfony/Component/Cache/Traits/RedisTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 9e34a6f89dd57..8a924b77a2984 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -179,8 +179,14 @@ public static function createConnection($dsn, array $options = []) $connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect'; $redis = new $class(); - $initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts) { + $initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts, $query) { $host = $hosts[0]['host'] ?? $hosts[0]['path']; + if (array_key_exists('tls', $query)) { + $tls = filter_var($query['tls'], FILTER_VALIDATE_BOOLEAN); + if ($tls) { + $host = 'tls://' . $host; + } + } $port = $hosts[0]['port'] ?? null; if (isset($params['redis_sentinel'])) { From b076adc320f1f15670dfe4171c16b8cd36873a72 Mon Sep 17 00:00:00 2001 From: viktor Date: Tue, 22 Dec 2020 01:02:44 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- src/Symfony/Component/Cache/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Cache/CHANGELOG.md b/src/Symfony/Component/Cache/CHANGELOG.md index 38d60a390d94b..cfabc49a922a8 100644 --- a/src/Symfony/Component/Cache/CHANGELOG.md +++ b/src/Symfony/Component/Cache/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * added support for connecting to Redis Sentinel clusters when using the Redis PHP extension + * added TLS support for \Redis connection in the DNS. Example: `redis://127.0.0.1?tls=1` 5.2.0 ----- From c6ae33cd7a5e869888b403226d1a46ad83b8b657 Mon Sep 17 00:00:00 2001 From: viktor Date: Tue, 22 Dec 2020 01:17:44 +0100 Subject: [PATCH 3/3] Apply fabbot's patch --- src/Symfony/Component/Cache/Traits/RedisTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 8a924b77a2984..dd5963e75d0d6 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -181,10 +181,10 @@ public static function createConnection($dsn, array $options = []) $initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts, $query) { $host = $hosts[0]['host'] ?? $hosts[0]['path']; - if (array_key_exists('tls', $query)) { - $tls = filter_var($query['tls'], FILTER_VALIDATE_BOOLEAN); + if (\array_key_exists('tls', $query)) { + $tls = filter_var($query['tls'], \FILTER_VALIDATE_BOOLEAN); if ($tls) { - $host = 'tls://' . $host; + $host = 'tls://'.$host; } } $port = $hosts[0]['port'] ?? null; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy