initialized after calling SearchResult::initFromTitle().
* The UserIsBlockedFrom hook is only called if a block is found first, and
should only be used to unblock a blocked user.
+* Parameters for index.php from PATH_INFO, such as the title, are no longer
+ written to $_GET.
* …
=== Deprecations in 1.34 ===
// PATH_INFO can be used for stupid things. We don't support it for api.php at
// all, so error out if it's present.
if ( isset( $_SERVER['PATH_INFO'] ) && $_SERVER['PATH_INFO'] != '' ) {
- $correctUrl = wfAppendQuery( wfScript( 'api' ), $wgRequest->getQueryValues() );
+ $correctUrl = wfAppendQuery( wfScript( 'api' ), $wgRequest->getQueryValuesOnly() );
$correctUrl = wfExpandUrl( $correctUrl, PROTO_CANONICAL );
header( "Location: $correctUrl", true, 301 );
echo 'This endpoint does not support "path info", i.e. extra text between "api.php"'
* @ingroup HTTP
*/
class WebRequest {
- /** @var array */
+ /**
+ * The parameters from $_GET, $_POST and the path router
+ * @var array
+ */
protected $data;
- /** @var array */
+
+ /**
+ * The parameters from $_GET. The parameters from the path router are
+ * added by interpolateTitle() during Setup.php.
+ * @var array
+ */
+ protected $queryAndPathParams;
+
+ /**
+ * The parameters from $_GET only.
+ */
+ protected $queryParams;
+
+ /**
+ * Lazy-initialized request headers indexed by upper-case header name
+ * @var array
+ */
protected $headers = [];
/**
// POST overrides GET data
// We don't use $_REQUEST here to avoid interference from cookies...
$this->data = $_POST + $_GET;
+
+ $this->queryAndPathParams = $this->queryParams = $_GET;
}
/**
$matches = self::getPathInfo( 'title' );
foreach ( $matches as $key => $val ) {
- $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val;
+ $this->data[$key] = $this->queryAndPathParams[$key] = $val;
}
}
}
/**
- * Get the values passed in the query string.
+ * Get the values passed in the query string and the path router parameters.
* No transformation is performed on the values.
*
* @codeCoverageIgnore
* @return array
*/
public function getQueryValues() {
- return $_GET;
+ return $this->queryAndPathParams;
+ }
+
+ /**
+ * Get the values passed in the query string only, not including the path
+ * router parameters. This is less suitable for self-links to index.php but
+ * useful for other entry points. No transformation is performed on the
+ * values.
+ *
+ * @since 1.34
+ * @return array
+ */
+ public function getQueryValuesOnly() {
+ return $this->queryParams;
}
/**
wfThumbHandle404();
} else {
// Called directly, use $_GET params
- wfStreamThumb( $wgRequest->getQueryValues() );
+ wfStreamThumb( $wgRequest->getQueryValuesOnly() );
}
$mediawiki = new MediaWiki();