1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00

Fix "AphrontRequest->getRequestURI()" for requests with "x[]=1" parameters in the URI

Summary:
Ref T13250. See PHI1069. This is a small fix for `getRequestURI()` currently not working if the request includes "x[]=..." PHP-flavored array parameters, beacause they're parsed into arrays by `$_GET` and `setQueryParams(...)` no longer accepts nonscalars.

Instead, just parse the raw request URI.

Test Plan: Visited `/search/hovercard/?phids[]=X`, no more fatal. Dumped the resulting URI, saw it had the right value. Tried `?phids[]=x&x=1&x=1&x=1`, saw the parameters correctly preserved.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13250

Differential Revision: https://secure.phabricator.com/D20147
This commit is contained in:
epriestley 2019-02-12 05:31:04 -08:00
parent 1fd69f788c
commit 308c4f2407

View file

@ -591,10 +591,15 @@ final class AphrontRequest extends Phobject {
}
public function getRequestURI() {
$get = $_GET;
unset($get['__path__']);
$request_uri = idx($_SERVER, 'REQUEST_URI', '/');
$uri = new PhutilURI($request_uri);
$uri->setQueryParam('__path__', null);
$path = phutil_escape_uri($this->getPath());
return id(new PhutilURI($path))->setQueryParams($get);
$uri->setPath($path);
return $uri;
}
public function getAbsoluteRequestURI() {