From 2b8a899f1b6250ec8f67496adabfff963dc4d655 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sat, 1 Feb 2025 11:03:07 +0100 Subject: [PATCH] fix validation of redis context parameters array (#315) (#317) The optional 7th argument the Redis::connect() holds an array of context parameters, required for authentication. This parameter can either be NULL or an array. Fix the condition, so it does not reject arrays. --- inc/class-cachify-redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/class-cachify-redis.php b/inc/class-cachify-redis.php index 28b1e00..e1aa999 100644 --- a/inc/class-cachify-redis.php +++ b/inc/class-cachify-redis.php @@ -271,7 +271,7 @@ private static function sanitize_con_parameters( $con ) { if ( count( $con ) > 5 ) { $con[5] = floatval( $con[5] ); // Read timeout in seconds. } - if ( count( $con ) > 6 && ! is_null( $con[6] ) && is_array( $con[6] ) ) { + if ( count( $con ) > 6 && ! is_null( $con[6] ) && ! is_array( $con[6] ) ) { return false; // Context parameters, e.g. authentication (since PhpRedis 5.3). } if ( count( $con ) > 7 ) {