X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FWebRequest.php;h=c94e8d4e23113113fa94af4441d41bd4ca159bc4;hb=110df55da94c238a1258a1b5486ff0a1c26a4b38;hp=7b14667d5a550a64164fcd1045cc705cc9630734;hpb=64281b6c524f54863174768c025dfe698948fc3f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 7b14667d5a..c94e8d4e23 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -40,9 +40,28 @@ use Wikimedia\AtEase\AtEase; * @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 = []; /** @@ -100,6 +119,8 @@ class WebRequest { // POST overrides GET data // We don't use $_REQUEST here to avoid interference from cookies... $this->data = $_POST + $_GET; + + $this->queryAndPathParams = $this->queryParams = $_GET; } /** @@ -336,7 +357,7 @@ class WebRequest { $matches = self::getPathInfo( 'title' ); foreach ( $matches as $key => $val ) { - $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val; + $this->data[$key] = $this->queryAndPathParams[$key] = $val; } } @@ -526,7 +547,7 @@ class WebRequest { * * @param string $name * @param array|null $default Option default (or null) - * @return array Array of ints + * @return int[]|null */ public function getIntArray( $name, $default = null ) { $val = $this->getArray( $name, $default ); @@ -668,14 +689,27 @@ class WebRequest { } /** - * 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; } /**