Skip to content

Commit 308c4f2

Browse files
author
epriestley
committedFeb 12, 2019
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
1 parent 1fd69f7 commit 308c4f2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎src/aphront/AphrontRequest.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,15 @@ public function getViewer() {
591591
}
592592

593593
public function getRequestURI() {
594-
$get = $_GET;
595-
unset($get['__path__']);
594+
$request_uri = idx($_SERVER, 'REQUEST_URI', '/');
595+
596+
$uri = new PhutilURI($request_uri);
597+
$uri->setQueryParam('__path__', null);
598+
596599
$path = phutil_escape_uri($this->getPath());
597-
return id(new PhutilURI($path))->setQueryParams($get);
600+
$uri->setPath($path);
601+
602+
return $uri;
598603
}
599604

600605
public function getAbsoluteRequestURI() {

0 commit comments

Comments
 (0)
Failed to load comments.