Per Catrope's request, commiting patch on bug 16017:
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 18 Oct 2008 10:09:19 +0000 (10:09 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 18 Oct 2008 10:09:19 +0000 (10:09 +0000)
* (bug 16017) list=categorymembers sets invalid continue parameters for sortkeys containing pipes

RELEASE-NOTES
includes/api/ApiQueryCategoryMembers.php

index ae25f19..268c2b6 100644 (file)
@@ -345,6 +345,8 @@ The following extensions are migrated into MediaWiki 1.14:
   descending order.
 * (bug 15995) Add cmstartsortkey and cmendsortkey parameters to
   list=categorymembers
+* (bug 16017) list=categorymembers sets invalid continue parameters for
+  sortkeys containing pipes
 
 === Languages updated in 1.14 ===
 
index ad5836c..ba8a472 100644 (file)
@@ -154,18 +154,15 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                if (is_null($continue))
                        return; // This is not a continuation request
 
-               $continueList = explode('|', $continue);
-               $hasError = count($continueList) != 2;
-               $from = 0;
-               if (!$hasError && strlen($continueList[1]) > 0) {
-                       $from = intval($continueList[1]);
-                       $hasError = ($from == 0);
-               }
+               $pos = strrpos($continue, '|');
+               $sortkey = substr($continue, 0, $pos);
+               $fromstr = substr($continue, $pos + 1);
+               $from = intval($fromstr);
 
-               if ($hasError)
+               if ($from == 0 && strlen($fromstr) > 0)
                        $this->dieUsage("Invalid continue param. You should pass the original value returned by the previous query", "badcontinue");
 
-               $encSortKey = $this->getDB()->addQuotes($continueList[0]);
+               $encSortKey = $this->getDB()->addQuotes($sortkey);
                $encFrom = $this->getDB()->addQuotes($from);
                
                $op = ($dir == 'desc' ? '<' : '>');