r81396 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81395‎ | r81396 | r81397 >
Date:15:44, 2 February 2011
Author:mah
Status:ok
Tags:
Comment:
* recover dropped check of $wgUsePathInfo from r81363
* document getPathInfo
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebRequest.php
@@ -55,7 +55,21 @@
5656 $this->data = $_POST + $_GET;
5757 }
5858
 59+ /**
 60+ * Extract the PATH_INFO variable even when it isn't a reasonable
 61+ * value. On some large webhosts, PATH_INFO includes the script
 62+ * path as well as everything after it.
 63+ *
 64+ * @param $want string: If this is not 'all', then the function
 65+ * will return an empty array if it determines that the URL is
 66+ * inside a rewrite path.
 67+ *
 68+ * @return Array: 'title' key is the title of the article.
 69+ */
5970 static public function getPathInfo( $want = 'all' ) {
 71+ // PATH_INFO is mangled due to http://bugs.php.net/bug.php?id=31892
 72+ // And also by Apache 2.x, double slashes are converted to single slashes.
 73+ // So we will use REQUEST_URI if possible.
6074 $matches = array();
6175 if ( !empty( $_SERVER['REQUEST_URI'] ) ) {
6276 // Slurp out the path portion to examine...
@@ -125,9 +139,11 @@
126140 return;
127141 }
128142
129 - $matches = self::getPathInfo( 'title' );
130 - foreach( $matches as $key => $val) {
131 - $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val;
 143+ if ( $wgUsePathInfo ) {
 144+ $matches = self::getPathInfo( 'title' );
 145+ foreach( $matches as $key => $val) {
 146+ $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val;
 147+ }
132148 }
133149 }
134150

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81363* Remove last bit of code that uses PATH_INFO from img_auth.php so that peopl...mah01:08, 2 February 2011

Status & tagging log