From 075dc3f57d77ec634aceaec500824872fb08b0eb Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 28 Mar 2013 09:37:37 +0100 Subject: [PATCH] Prevent PHP notice by adding isset() check Issue was caused by change I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36 Bug: 46627 Change-Id: Ida87efc622e9e90b835473f069559817565eafc1 --- includes/WebRequest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 30a51b04f1..739340c3c4 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -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. -- 2.20.1