* (bug 30041) Fix memcached validation in installer to accept resolvable hostnames
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 22 Sep 2011 00:11:03 +0000 (00:11 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 22 Sep 2011 00:11:03 +0000 (00:11 +0000)
'localhost:11211' was rejected because 'localhost' isn't an IP address... however it's a perfectly legit host to connect to. :)

Followup to r82687 which introduced the IP address check.

includes/installer/WebInstallerPage.php

index 4d83991..3132606 100644 (file)
@@ -1081,8 +1081,10 @@ class WebInstaller_Options extends WebInstallerPage {
                        }
 
                        foreach( $memcServers as $server ) {
-                               $memcParts = explode( ":", $server );
-                               if( !IP::isValid( $memcParts[0] ) ) {
+                               $memcParts = explode( ":", $server, 2 );
+                               if ( !isset( $memcParts[0] )
+                                               || ( !IP::isValid( $memcParts[0] )
+                                                       && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) ) ) {
                                        $this->parent->showError( 'config-memcache-badip', $memcParts[0] );
                                        return false;
                                } elseif( !isset( $memcParts[1] )  ) {