From: Matthew Flaschen Date: Thu, 30 Jul 2015 21:38:42 +0000 (-0400) Subject: Throw exception on falsy server in RedisConnectionPool. X-Git-Tag: 1.31.0-rc.0~10574^2 X-Git-Url: http://git.cyclocoop.org/%22.%20%20%20generer_url_action%28%22logout%22%2C%22logout=prive%22%29%20.%20%20%20%22?a=commitdiff_plain;h=70e949bdc2bfb7d06c07955fc81505567bcf7818;p=lhc%2Fweb%2Fwiklou.git Throw exception on falsy server in RedisConnectionPool. Surprisingly, IP::splitHostAndPort does not return false for these. Also, tweak documentation of splitHostAndPort. Bug: T107498 Change-Id: I4230b1e7ba0fa2d28be8de3e0e7b064e58f0579c --- diff --git a/includes/clientpool/RedisConnectionPool.php b/includes/clientpool/RedisConnectionPool.php index 599fb6aa28..117bd2d851 100644 --- a/includes/clientpool/RedisConnectionPool.php +++ b/includes/clientpool/RedisConnectionPool.php @@ -218,7 +218,7 @@ class RedisConnectionPool implements LoggerAwareInterface { } else { // TCP connection $hostPort = IP::splitHostAndPort( $server ); - if ( !$hostPort ) { + if ( !$server || !$hostPort ) { throw new MWException( __CLASS__ . ": invalid configured server \"$server\"" ); } list( $host, $port ) = $hostPort; diff --git a/includes/utils/IP.php b/includes/utils/IP.php index dfcbe7850f..ae3736aeec 100644 --- a/includes/utils/IP.php +++ b/includes/utils/IP.php @@ -240,7 +240,7 @@ class IP { * A bare IPv6 address is accepted despite the lack of square brackets. * * @param string $both The string with the host and port - * @return array + * @return array|false Array normally, false on certain failures */ public static function splitHostAndPort( $both ) { if ( substr( $both, 0, 1 ) === '[' ) {