From 81130fd8604b2828c5c40ecf110fb1d0fe65070a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 18 Apr 2008 14:04:46 +0000 Subject: [PATCH] Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category::newFromName does not always return an object! --- RELEASE-NOTES | 1 + includes/CoreParserFunctions.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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; -- 2.20.1