(bug 15706) Empty values for apprtype and apprlevel are now silently ignored rather...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Sep 2008 14:50:09 +0000 (14:50 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Sep 2008 14:50:09 +0000 (14:50 +0000)
RELEASE-NOTES
includes/api/ApiQueryAllpages.php

index 0dc5d93..9ea3c29 100644 (file)
@@ -271,6 +271,8 @@ The following extensions are migrated into MediaWiki 1.14:
 * action=protect checks for invalid protection types and levels
 * (bug 15673) Added indentation to format=wddxfm output and improved built-in 
   WDDX formatter to resemble PHP's more
+* (bug 15706) Empty values for apprtype and apprlevel are now silently ignored
+  rather than causing an exception
 
 === Languages updated in 1.14 ===
 
index 97f1c39..b0f4759 100644 (file)
@@ -79,14 +79,15 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                }
 
                // Page protection filtering
-               if (isset ($params['prtype'])) {
+               if (!empty ($params['prtype'])) {
                        $this->addTables('page_restrictions');
                        $this->addWhere('page_id=pr_page');
                        $this->addWhere('pr_expiry>' . $db->addQuotes($db->timestamp()));
                        $this->addWhereFld('pr_type', $params['prtype']);
 
-                       $prlevel = $params['prlevel'];
-                       if (!is_null($prlevel) && $prlevel != '' && $prlevel != '*')
+                       // Remove the empty string and '*' from the prlevel array
+                       $prlevel = array_diff($params['prlevel'], array('', '*'));
+                       if (!empty($prlevel))
                                $this->addWhereFld('pr_level', $prlevel);
 
                        $this->addOption('DISTINCT');