From: Siebrand Mazeland Date: Thu, 28 Mar 2013 08:37:37 +0000 (+0100) Subject: Prevent PHP notice by adding isset() check X-Git-Tag: 1.31.0-rc.0~20191^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=075dc3f57d77ec634aceaec500824872fb08b0eb;p=lhc%2Fweb%2Fwiklou.git Prevent PHP notice by adding isset() check Issue was caused by change I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36 Bug: 46627 Change-Id: Ida87efc622e9e90b835473f069559817565eafc1 --- 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.