MediaWiki r42197 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r42196‎ | r42197 (on ViewVC)‎ | r42198 >
Date:10:09, 18 October 2008
Author:ialex
Status:old
Tags:
Comment:
Per Catrope's request, commiting patch on bug 16017:
* (bug 16017) list=categorymembers sets invalid continue parameters for sortkeys containing pipes
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategoryMembers.php	(revision 42196)
+++ trunk/phase3/includes/api/ApiQueryCategoryMembers.php	(revision 42197)
@@ -154,18 +154,15 @@
 		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' ? '<' : '>');
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42196)
+++ trunk/phase3/RELEASE-NOTES	(revision 42197)
@@ -345,6 +345,8 @@
   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 ===
 

Status & tagging log

  • 17:05, 4 January 2012 Johnduhart (Talk | contribs) changed the tags for r42197 [removed: api]
  • 15:36, 12 September 2011 Meno25 (Talk | contribs) changed the status of r42197 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox