Last modified: 2008-11-02 22:40:54 UTC
Created attachment 5470 [details] Patch to add API support to Spam Blacklist Regarding revision r42580. When the spam blacklist triggers on an API edit, MediaWiki simply dies with a 500 Internal Server Error instead of returning any sort of proper error code. If php is configured not to output errors to the browser, the body of the error is an empty page; if it does output errors, the following is produced: (with php 5.2.6) <br /> <b>Catchable fatal error</b>: Argument 2 passed to Parser::parse() must be an instance of Title, null given, called in /usr/local/src/MediaWiki/phase3/includes/OutputPage.php on line 633 and defined in <b>/usr/local/src/MediaWiki/phase3/includes/parser/Parser.php</b> on line <b>300</b><br /> The attached patch adds API support to Spam Blacklist, although I'm sure there is more than one way to do it. With this patch, an API edit attempt will now output something useful instead of crashing: <?xml version="1.0"?><api><edit spamblacklist="http://blacklistme.example.com" result="Failure" /></api>
(In reply to comment #0) > Created an attachment (id=5470) [details] > Patch to add API support to Spam Blacklist > > Regarding revision r42580. That revision is totally unrelated. Sure you didn't get the number wrong? > When the spam blacklist triggers on an API edit, MediaWiki simply dies with a > 500 Internal Server Error instead of returning any sort of proper error code. > If php is configured not to output errors to the browser, the body of the error > is an empty page; if it does output errors, the following is produced: (with > php 5.2.6) > > <br /> > <b>Catchable fatal error</b>: Argument 2 passed to Parser::parse() must be an > instance of Title, null given, called in > /usr/local/src/MediaWiki/phase3/includes/OutputPage.php on line 633 and defined > in <b>/usr/local/src/MediaWiki/phase3/includes/parser/Parser.php</b> on line > <b>300</b><br /> > > The attached patch adds API support to Spam Blacklist, although I'm sure there > is more than one way to do it. With this patch, an API edit attempt will now > output something useful instead of crashing: > > <?xml version="1.0"?><api><edit spamblacklist="http://blacklistme.example.com" > result="Failure" /></api> > Looks good. is_null($wgTitle) is maybe not ideal to check for API edit mode, but it's the best we have right now.
(In reply to comment #1) > (In reply to comment #0) > > Regarding revision r42580. > That revision is totally unrelated. Sure you didn't get the number wrong? It was the revision reported by "svn info" on my local copy of the tree when I tested this and created the patch. Sorry for the confusion.
Applied in r43098.