http://www.mediawiki.org/wiki/Special:Code/MediaWiki/81396

Revision: 81396
Author:   mah
Date:     2011-02-02 15:44:37 +0000 (Wed, 02 Feb 2011)
Log Message:
-----------
* recover dropped check of $wgUsePathInfo from r81363
* document getPathInfo

Modified Paths:
--------------
    trunk/phase3/includes/WebRequest.php

Modified: trunk/phase3/includes/WebRequest.php
===================================================================
--- trunk/phase3/includes/WebRequest.php        2011-02-02 15:43:54 UTC (rev 
81395)
+++ trunk/phase3/includes/WebRequest.php        2011-02-02 15:44:37 UTC (rev 
81396)
@@ -55,7 +55,21 @@
                $this->data = $_POST + $_GET;
        }
 
+       /**
+        * Extract the PATH_INFO variable even when it isn't a reasonable
+        * value. On some large webhosts, PATH_INFO includes the script
+        * path as well as everything after it.
+        *
+        * @param $want string: If this is not 'all', then the function
+        * will return an empty array if it determines that the URL is
+        * inside a rewrite path.
+        *
+        * @return Array: 'title' key is the title of the article.
+        */
        static public function getPathInfo( $want = 'all' ) {
+               // PATH_INFO is mangled due to 
http://bugs.php.net/bug.php?id=31892
+               // And also by Apache 2.x, double slashes are converted to 
single slashes.
+               // So we will use REQUEST_URI if possible.
                $matches = array();
                if ( !empty( $_SERVER['REQUEST_URI'] ) ) {
                        // Slurp out the path portion to examine...
@@ -125,9 +139,11 @@
                        return;
                }
 
-               $matches = self::getPathInfo( 'title' );
-               foreach( $matches as $key => $val) {
-                       $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = 
$val;
+               if ( $wgUsePathInfo ) {
+                       $matches = self::getPathInfo( 'title' );
+                       foreach( $matches as $key => $val) {
+                               $this->data[$key] = $_GET[$key] = 
$_REQUEST[$key] = $val;
+                       }
                }
        }
 


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to