From fe5f0db0f4a8e3fe88380d9c5e49e078602a775e Mon Sep 17 00:00:00 2001 From: EarthlingDavey <15802017+EarthlingDavey@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:19:48 +0100 Subject: [PATCH 1/2] Don't check file system when host has protocol/scheme. Fixes https://github.com/pantheon-systems/wp-redis/issues/442 --- object-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-cache.php b/object-cache.php index e84beef..530348c 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1268,7 +1268,7 @@ public function build_client_parameters( $redis_server ) { } } - if ( file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. + if ( ! str_contains( $redis_server['host'], '://' ) && file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. // port must be null or socket won't connect. unset( $redis_server['port'] ); $port = null; From f51856e6fd69df8e3de0e7f5a3270e283b5669c7 Mon Sep 17 00:00:00 2001 From: EarthlingDavey <15802017+EarthlingDavey@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:31:16 +0100 Subject: [PATCH 2/2] Change matching to explicit tls, redis & rediss protocols. --- object-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-cache.php b/object-cache.php index 530348c..e831330 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1268,7 +1268,7 @@ public function build_client_parameters( $redis_server ) { } } - if ( ! str_contains( $redis_server['host'], '://' ) && file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. + if ( ! preg_match('/^(tl|redis?)s:\/\//', $redis_server['host']) && file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. // port must be null or socket won't connect. unset( $redis_server['port'] ); $port = null;