Page MenuHomePhabricator

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

Authored by epriestley on Feb 12 2019, 1:42 PM.
Tags
None
Referenced Files
F19081991: D20147.id.diff
Tue, Dec 2, 9:09 AM
F19075205: D20147.diff
Mon, Dec 1, 8:58 AM
F18970874: D20147.diff
Nov 15 2025, 9:12 AM
F18870912: D20147.id48115.diff
Nov 4 2025, 7:45 PM
F18856373: D20147.id.diff
Nov 1 2025, 9:29 AM
F18849230: D20147.diff
Oct 30 2025, 8:36 AM
F18836070: D20147.diff
Oct 26 2025, 9:43 PM
F18824771: D20147.id48107.diff
Oct 23 2025, 5:53 PM
Subscribers
None

Details

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.

Diff Detail

Repository
rP Phabricator
Branch
hover1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 21950
Build 29972: Run Core Tests
Build 29971: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Feb 12 2019, 6:49 PM

There's some small possibility that $_GET and REQUEST_URI do not agree in some environments and that this will create even more problems. However, they agree locally, and we already use REQUEST_URI in some other cases without issues, and I couldn't find any internet evidence that REQUEST_URI is suspect.

We do have some code to turn a bag of PHP-flavored parameters into a query string (AphrontRequest::flattenData()) so we could just flatten $_GET, but that code is pretty icky so I'm hoping we can get away without increasing our reliance on it.

This revision was automatically updated to reflect the committed changes.