Prevent undesired toggling on Special:NewPages
authorMatěj Suchánek <matejsuchanek97@gmail.com>
Sun, 3 Feb 2019 12:17:04 +0000 (13:17 +0100)
committerMatěj Suchánek <matejsuchanek97@gmail.com>
Sun, 3 Feb 2019 12:18:30 +0000 (13:18 +0100)
Bug: T211549
Change-Id: I09928674c66a6359a417a221049259cb318dd00a

includes/specials/SpecialNewpages.php

index 8051b0b..2bbc0bf 100644 (file)
@@ -192,9 +192,12 @@ class SpecialNewpages extends IncludableSpecialPage {
                // 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 );
+               // Also do this only for boolean options, not eg. namespace or tagfilter
+               foreach ( $changed as $key => $value ) {
+                       if ( array_key_exists( $key, $filters ) ) {
+                               $changed[$key] = $changed[$key] ? '1' : '0';
+                       }
+               }
 
                $self = $this->getPageTitle();
                $linkRenderer = $this->getLinkRenderer();