Surprisingly, IP::splitHostAndPort does not return false for these.
Also, tweak documentation of splitHostAndPort.
Bug: T107498
Change-Id: I4230b1e7ba0fa2d28be8de3e0e7b064e58f0579c
} else {
// TCP connection
$hostPort = IP::splitHostAndPort( $server );
- if ( !$hostPort ) {
+ if ( !$server || !$hostPort ) {
throw new MWException( __CLASS__ . ": invalid configured server \"$server\"" );
}
list( $host, $port ) = $hostPort;
* 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 ) === '[' ) {