From 241f06c9ffc63909ec04e29f67f53cb310fb1953 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 12 Feb 2019 13:18:32 -0800 Subject: [PATCH] Clean up final `setQueryParams()` callsites Summary: Ref T13250. See D20149. Test Plan: All trivial? Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13250 Differential Revision: https://secure.phabricator.com/D20153 --- src/aphront/AphrontRequest.php | 5 ++++- src/aphront/response/AphrontResponse.php | 2 +- src/applications/auth/provider/PhabricatorAuthProvider.php | 2 +- .../files/controller/PhabricatorFileDataController.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php index a65566e867..38eb5a6ffc 100644 --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -829,7 +829,10 @@ final class AphrontRequest extends Phobject { } $uri->setPath($this->getPath()); - $uri->setQueryParams(self::flattenData($_GET)); + $uri->removeAllQueryParams(); + foreach (self::flattenData($_GET) as $query_key => $query_value) { + $uri->appendQueryParam($query_key, $query_value); + } $input = PhabricatorStartup::getRawInput(); diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php index 0eab91b2af..9cfda0f5c1 100644 --- a/src/aphront/response/AphrontResponse.php +++ b/src/aphront/response/AphrontResponse.php @@ -218,7 +218,7 @@ abstract class AphrontResponse extends Phobject { $uri = id(new PhutilURI($uri)) ->setPath(null) ->setFragment(null) - ->setQueryParams(array()); + ->removeAllQueryParams(); $uri = (string)$uri; if (preg_match('/[ ;\']/', $uri)) { diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php index 78aeebd810..dfdc7c6a5b 100644 --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -447,7 +447,7 @@ abstract class PhabricatorAuthProvider extends Phobject { $uri = $attributes['uri']; $uri = new PhutilURI($uri); $params = $uri->getQueryParamsAsPairList(); - $uri->setQueryParams(array()); + $uri->removeAllQueryParams(); $content = array($button); diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php index dd5e0adb7d..8ceb1e7907 100644 --- a/src/applications/files/controller/PhabricatorFileDataController.php +++ b/src/applications/files/controller/PhabricatorFileDataController.php @@ -135,7 +135,7 @@ final class PhabricatorFileDataController extends PhabricatorFileController { $request_uri = id(clone $request->getAbsoluteRequestURI()) ->setPath(null) ->setFragment(null) - ->setQueryParams(array()); + ->removeAllQueryParams(); $response->addContentSecurityPolicyURI( 'object-src',