diff --git a/object-cache.php b/object-cache.php index 4f04b77..c20156f 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1167,8 +1167,8 @@ public function build_client_parameters( $redis_server ) { if ( isset( $_SERVER['CACHE_HOST'] ) ) { $redis_server = array( 'host' => $_SERVER['CACHE_HOST'], - 'port' => $_SERVER['CACHE_PORT'], - 'auth' => $_SERVER['CACHE_PASSWORD'], + 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379, + 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'], null, 'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0, ); } else { diff --git a/wp-redis.php b/wp-redis.php index 5da9639..07af5e1 100644 --- a/wp-redis.php +++ b/wp-redis.php @@ -39,8 +39,8 @@ function wp_redis_get_info() { if ( isset( $_SERVER['CACHE_HOST'] ) ) { $redis_server = array( 'host' => $_SERVER['CACHE_HOST'], - 'port' => $_SERVER['CACHE_PORT'], - 'auth' => $_SERVER['CACHE_PASSWORD'], + 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379, + 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'], null, 'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0, ); } else {