From: Kevin Israel Date: Wed, 27 Mar 2013 23:44:48 +0000 (-0400) Subject: WebRequest::getRequestURL: Follow up Ibe00a6b8 X-Git-Tag: 1.31.0-rc.0~20178^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=516fcfe0ca27af4041f289dfd2055cd5aa8b66aa;p=lhc%2Fweb%2Fwiklou.git WebRequest::getRequestURL: Follow up Ibe00a6b8 * Only match consecutive slashes at the beginning of the URL, where they are actually a problem. * Fix bug 46607 in cases where the server provides an absolute URL. Change-Id: Ibe00a6b8722786170d09b846c1c4054b73da3d9e --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 739340c3c4..3bdf6452b6 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -656,14 +656,11 @@ class WebRequest { } if( $base[0] == '/' ) { - if( isset( $base[1] ) && $base[1] == '/' ) { /* More than one slash will look like it is protocol relative */ - return preg_replace( '!//*!', '/', $base ); - } - - return $base; + // More than one slash will look like it is protocol relative + return preg_replace( '!^/+!', '/', $base ); } else { // We may get paths with a host prepended; strip it. - return preg_replace( '!^[^:]+://[^/]+/!', '/', $base ); + return preg_replace( '!^[^:]+://[^/]+/+!', '/', $base ); } }