From 0d0d7b555992a3a8ae82329da5bd9e7b9d30c9a8 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 18 Oct 2008 10:09:19 +0000 Subject: [PATCH] Per Catrope's request, commiting patch on bug 16017: * (bug 16017) list=categorymembers sets invalid continue parameters for sortkeys containing pipes --- RELEASE-NOTES | 2 ++ includes/api/ApiQueryCategoryMembers.php | 15 ++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ae25f19ba8..268c2b6f32 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index ad5836caa4..ba8a472815 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -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' ? '<' : '>'); -- 2.20.1