Prevent:
authorNick Jenkins <nickj@users.mediawiki.org>
Tue, 19 Dec 2006 05:38:55 +0000 (05:38 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Tue, 19 Dec 2006 05:38:55 +0000 (05:38 +0000)
* Strict Standards: Undefined variable: dbr in includes/SpecialAllpages.php on line 266
* Fatal error:  Call to a member function select() on a non-object in includes/SpecialAllpages.php on line 266
* Strict Standards: Undefined variable: n in includes/SpecialAllpages.php on line 308
Above could be repo-ed with error_reporting(E_ALL | E_STRICT) set, by supplying bad input, such as this command line:
curl --silent --include --globoff  -F 'from'='\<' 'http://localhost/wiki/index.php?title=Special%3AAllpages'
(or easier is to just type "<" into the "Display pages starting at:" field on [[Special:Allpages]], and click "Go")

includes/SpecialAllpages.php

index c68026a..737e683 100644 (file)
@@ -210,7 +210,8 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
        $sk = $wgUser->getSkin();
 
        $fromList = $this->getNamespaceKeyAndText($namespace, $from);
-
+       $n = 0;
+        
        if ( !$fromList ) {
                $out = wfMsgWikiHtml( 'allpagesbadtitle' );
        } else {
@@ -231,7 +232,6 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
                        )
                );
 
-               $n = 0;
                $out = '<table style="background: inherit;" border="0" width="100%">';
 
                while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
@@ -263,6 +263,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
        } else {
 
                # Get the last title from previous chunk
+               $dbr =& wfGetDB( DB_SLAVE );
                $res_prev = $dbr->select(
                        'page',
                        'page_title',