Fix bug in sorting due to $wgRequest eating nulls
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 3 Aug 2010 20:50:46 +0000 (20:50 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 3 Aug 2010 20:50:46 +0000 (20:50 +0000)
I'll fix this up so that the query string looks nicer later.  Embedding
nulls in query strings is not a great idea.

includes/CategoryPage.php

index b12c13f..9dee972 100644 (file)
@@ -55,11 +55,14 @@ class CategoryPage extends Article {
 
                $from = $until = array();
                foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
-                       $from[$type] = $wgRequest->getVal( "{$type}from" );
-                       $until[$type] = $wgRequest->getVal( "{$type}until" );
+                       # Use $_GET instead of $wgRequest, because the latter helpfully
+                       # normalizes Unicode, which removes nulls.  TODO: do something
+                       # smarter than passing nulls in URLs.  :/
+                       $from[$type] = isset( $_GET["{$type}from"] ) ? $_GET["{$type}from"] : null;
+                       $until[$type] = isset( $_GET["{$type}until"] ) ? $_GET["{$type}until"] : null;
                }
 
-               $viewer = new CategoryViewer( $this->mTitle, $from, $until, $wgRequest->getValues() );
+               $viewer = new CategoryViewer( $this->mTitle, $from, $until, $_GET );
                $wgOut->addHTML( $viewer->getHTML() );
        }
 }