Prevent PHP notice by adding isset() check
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 28 Mar 2013 08:37:37 +0000 (09:37 +0100)
committerSiebrand <siebrand@wikimedia.org>
Thu, 28 Mar 2013 08:42:51 +0000 (08:42 +0000)
Issue was caused by change
I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36

Bug: 46627
Change-Id: Ida87efc622e9e90b835473f069559817565eafc1

includes/WebRequest.php

index 30a51b0..739340c 100644 (file)
@@ -654,10 +654,12 @@ class WebRequest {
                if( $hash !== false ) {
                        $base = substr( $base, 0, $hash );
                }
+
                if( $base[0] == '/' ) {
-                       if( $base[1] == '/' ) { /* More than one slash will look like it is protocol relative */
+                       if( isset( $base[1] ) && $base[1] == '/' ) { /* More than one slash will look like it is protocol relative */
                                return preg_replace( '!//*!', '/', $base );
                        }
+
                        return $base;
                } else {
                        // We may get paths with a host prepended; strip it.