Skip to content

Commit

Permalink
fix validation of redis context parameters array (#315) (#317)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stklcode committed Feb 1, 2025
1 parent 8a608f1 commit 2b8a899
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inc/class-cachify-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 2b8a899

Please sign in to comment.