From 005eb5f9fcec77bc184214770fde82db5fc72799 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 16 Feb 2019 07:26:19 -0800 Subject: [PATCH] (stable) Fix a couple more "URI->alter()" callsites in paging code Summary: `grep` had a hard time finding these. Test Plan: Will just hotfix this since I'm still reasonably in the deploy window, this currently fatals: Reviewers: amckinley Differential Revision: https://secure.phabricator.com/D20186 --- src/view/phui/PHUIPagerView.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/view/phui/PHUIPagerView.php b/src/view/phui/PHUIPagerView.php index b78efcda96..2bb3a8276e 100644 --- a/src/view/phui/PHUIPagerView.php +++ b/src/view/phui/PHUIPagerView.php @@ -187,9 +187,15 @@ final class PHUIPagerView extends AphrontView { foreach ($pager_index as $key => $index) { if ($index !== null) { $display_index = $this->getDisplayIndex($index); - $pager_links[$key] = (string)$base_uri->alter( - $parameter, - $display_index); + + $uri = id(clone $base_uri); + if ($display_index === null) { + $uri->removeQueryParam($parameter); + } else { + $uri->replaceQueryParam($parameter, $display_index); + } + + $pager_links[$key] = phutil_string_cast($uri); } } Javelin::initBehavior('phabricator-keyboard-pager', $pager_links); @@ -200,10 +206,17 @@ final class PHUIPagerView extends AphrontView { foreach ($links as $link) { list($index, $label, $class) = $link; $display_index = $this->getDisplayIndex($index); - $link = $base_uri->alter($parameter, $display_index); + + $uri = id(clone $base_uri); + if ($display_index === null) { + $uri->removeQueryParam($parameter); + } else { + $uri->replaceQueryParam($parameter, $display_index); + } + $rendered_links[] = id(new PHUIButtonView()) ->setTag('a') - ->setHref($link) + ->setHref($uri) ->setColor(PHUIButtonView::GREY) ->addClass('mml') ->addClass($class)