From d84720dedeb6129ab05f7d84e82d9e3001a72e55 Mon Sep 17 00:00:00 2001 From: Florian Schmidt Date: Thu, 2 Mar 2017 18:34:03 +0100 Subject: [PATCH] SpecialNewPages: Fix omitted Show/Hide redirect value The URL parameters will internally parsed to true/false by FormOptions for the SpecialNewPages class. However, FormOptions::getChangedValues() will also return an array with values of type boolean. wfArrayToCgi() on the other hand, according to the doc, does not output null and false values if an array is passed to it (which is done through the LinkRenderer/Title). This can be fixed by translating the values from a boolean true false to a true false parsed as URL values (1 and 0). I did this in the SpecialNewPages itself, as I'm pretty sure, that this does not belong to the FormOptions::getChangedValues() function and not to the wfArrayToCgi() function (which would change a very basic and documented functioning from a widely used method). Bug: T158504 Change-Id: I6660373b002bdb3a03edaf3b64557ffac8f25c6c --- includes/specials/SpecialNewpages.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index e2c9eab1ce..e378bcf7a3 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -189,6 +189,13 @@ class SpecialNewpages extends IncludableSpecialPage { $changed = $this->opts->getChangedValues(); unset( $changed['offset'] ); // Reset offset if query type changes + // wfArrayToCgi(), called from LinkRenderer/Title, will not output null and false values + // to the URL, which would omit some options (T158504). Fix it by explicitly setting them + // to 0 or 1. + $changed = array_map( function ( $value ) { + return $value ? '1' : '0'; + }, $changed ); + $self = $this->getPageTitle(); $linkRenderer = $this->getLinkRenderer(); foreach ( $filters as $key => $msg ) { -- 2.20.1