PleaseStand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/56344


Change subject: Fix handling of / in WebRequest::getRequestURL
......................................................................

Fix handling of / in WebRequest::getRequestURL

* Fixed a regression caused by I34c3fc9d: URL / results
  in a PHP notice.
* Fixed the case where $base is an absolute URL.

Change-Id: Ibe00a6b8722786170d09b846c1c4054b73da3d9e
---
M includes/WebRequest.php
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/56344/1

diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index 30a51b0..1ab8343 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -655,13 +655,11 @@
                        $base = substr( $base, 0, $hash );
                }
                if( $base[0] == '/' ) {
-                       if( $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 );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/56344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe00a6b8722786170d09b846c1c4054b73da3d9e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to