Last modified: 2010-07-30 05:42:59 UTC
The API on enwiki is now giving fatal errors when the special value "max" is set for the limit parameter of various modules (I've tried prop=categories, revisions, and templates quickly, and all three had the problem). The error message is "Exception Caught: Internal error in ApiResult::setElement: Attempting to add element categories=500, existing value is 500". In my local installation of Mediawiki, this error occurs with r69776 and does not occur with r69775. I haven't yet attempted to see what exactly in that 1334-line diff might have broken things.
Backtrace if it helps: http://pastebin.ca/WtfmbvfF password is pants
Fixed.
Re-opening as problem still occurs[1] if using generators as pointed out[2] in the mailing list. 1 - http://en.wikipedia.org/w/api.php?gbltitle=American&prop=info&action=query&generator=backlinks&gbllimit=max 2 - http://lists.wikimedia.org/pipermail/mediawiki-api/2010-July/001896.html
Too late, it's released now.
The problem is: 1) ApiMain::execute calls extractRequestParams with $parseLimit = true 2) The limit=max gets parsed and added to the result 3) ApiQueryBacklinks::run calls extractRequestParams with $parseLimit = false 4) ApiQueryBacklinks::run calculates its own limit and adds that to the result I will make a fix where for limits calls overwriting is allowed.
Fixed in r70078, needs deployment.
I was going to suggest changing it to $generator->extractRequestParams( false ) and $module->extractRequestParams( false ) in ApiQuery.php, but I guess that works. Your version also causes bug 21310 to be broken in a different, less annoying way.
*** Bug 24571 has been marked as a duplicate of this bug. ***
It's deployed now.