r33546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33545‎ | r33546 | r33547 >
Date:14:04, 18 April 2008
Author:simetrical
Status:old
Tags:
Comment:
Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category::newFromName does not always return an object!
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/CoreParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CoreParserFunctions.php
@@ -218,12 +218,12 @@
219219
220220 static function pagesincategory( $parser, $category = '', $raw = null ) {
221221 global $wgExpensiveParserFunctionLimit;
222 - if ($category == '') {
 222+ $category = Category::newFromName($category);
 223+ if( !is_object( $category ) ) {
223224 return 0;
224225 }
225226 $parser->mExpensiveFunctionCount++;
226227 if ($parser->mExpensiveFunctionCount <= $wgExpensiveParserFunctionLimit) {
227 - $category = Category::newFromName($category);
228228 $count = $category->getPageCount();
229229 if ( !$count ) {
230230 $count = 0;
Index: trunk/phase3/RELEASE-NOTES
@@ -200,6 +200,7 @@
201201 * (bug 13768) pt_title field encoding fixed
202202 * Do not display empty columns on Special:UserRights if all groups are
203203 changeable or all unchangeable
 204+* Fix fatal error on calling PAGESINCATEGORY with invalid category name
204205
205206
206207 === API changes in 1.13 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r33574Add parser regression test case for r33546 fatal error fixbrion22:55, 18 April 2008

Status & tagging log