Stop mangling $_GET and provide WebRequest::getQueryValuesOnly()
authorTim Starling <tstarling@wikimedia.org>
Tue, 3 Sep 2019 00:25:19 +0000 (10:25 +1000)
committerTim Starling <tstarling@wikimedia.org>
Thu, 5 Sep 2019 05:00:28 +0000 (15:00 +1000)
commit0c0676c34eeced65847f20b896049070a766a532
tree7a0690daba1750f365e96002ec9e75275e20f26c
parent7c9f1a122712362b5840aee0325e36b249cb79db
Stop mangling $_GET and provide WebRequest::getQueryValuesOnly()

I doubt there was ever a good reason for mangling $_GET to add the
title, this was just b/c for the sake of b/c. It was formerly used in
core but that was so long ago that I doubt there was any usage in
extensions at the time. Now there is one usage of $_GET['title'] in an
unmaintained extension, but it was only added in 2017.

Also I added WebRequest::getQueryValuesOnly() which is an interface to
the unmodified $_GET. The motivation is allowing OAuth to work with the
REST API, since OAuth needs an unmangled view of $_GET for signature
generation. The Action API gets around the problem with a special hack
in interpolateTitle(), disabling it for the Action API only.

A review of callers of getQueryValues() suggests that many would
benefit from using getQueryValuesOnly() instead. But I only changed it for
callers in api.php and thumb.php since the effect of the change there is
certainly beneficial, whereas callers under index.php may possibly be using
the path parameters to construct self-links.

Rest\RequestFromGlobals uses $_GET directly, which means that this
change causes it to not return PathRouter matches as GET parameters
anymore.

Change-Id: Ic469577fae17c0b1ac69466df7bc9f03e61c74e3
RELEASE-NOTES-1.34
api.php
includes/WebRequest.php
includes/api/ApiBase.php
thumb.php