Move position of $prlevel array stripping, and check isset
authorSam Reed <reedy@users.mediawiki.org>
Tue, 19 Jan 2010 17:23:31 +0000 (17:23 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 19 Jan 2010 17:23:31 +0000 (17:23 +0000)
action=query&list=allpages&apfrom=B&apprtype=edit

Gave

Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /home/reedy/mediawiki/trunk/phase3/includes/api/ApiQueryAllpages.php on line 99

includes/api/ApiQueryAllpages.php

index 39bc360..4f8fe40 100644 (file)
@@ -95,10 +95,13 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                        $this->addWhere( 'pr_expiry>' . $db->addQuotes( $db->timestamp() ) );
                        $this->addWhereFld( 'pr_type', $params['prtype'] );
 
-                       // Remove the empty string and '*' from the prlevel array
-                       $prlevel = array_diff( $params['prlevel'], array( '', '*' ) );
-                       if ( !empty( $prlevel ) )
-                               $this->addWhereFld( 'pr_level', $prlevel );
+                       if ( isset ( $params['prlevel'] ) ) {
+                               // Remove the empty string and '*' from the prlevel array
+                               $prlevel = array_diff( $params['prlevel'], array( '', '*' ) );
+                               
+                               if ( !empty( $prlevel ) )
+                                       $this->addWhereFld( 'pr_level', $prlevel );
+                       }
                        if ( $params['prfiltercascade'] == 'cascading' )
                                $this->addWhereFld( 'pr_cascade', 1 );
                        else if ( $params['prfiltercascade'] == 'noncascading' )