From: Aryeh Gregor Date: Fri, 18 Apr 2008 14:04:46 +0000 (+0000) Subject: Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category:... X-Git-Tag: 1.31.0-rc.0~48206 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=81130fd8604b2828c5c40ecf110fb1d0fe65070a;p=lhc%2Fweb%2Fwiklou.git Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category::newFromName does not always return an object! --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4c50b8a48b..65cf8fa456 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -200,6 +200,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 13768) pt_title field encoding fixed * Do not display empty columns on Special:UserRights if all groups are changeable or all unchangeable +* Fix fatal error on calling PAGESINCATEGORY with invalid category name === API changes in 1.13 === diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index 88b38fa236..779685e778 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -218,12 +218,12 @@ class CoreParserFunctions { static function pagesincategory( $parser, $category = '', $raw = null ) { global $wgExpensiveParserFunctionLimit; - if ($category == '') { + $category = Category::newFromName($category); + if( !is_object( $category ) ) { return 0; } $parser->mExpensiveFunctionCount++; if ($parser->mExpensiveFunctionCount <= $wgExpensiveParserFunctionLimit) { - $category = Category::newFromName($category); $count = $category->getPageCount(); if ( !$count ) { $count = 0;