Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category:...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Apr 2008 14:04:46 +0000 (14:04 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Apr 2008 14:04:46 +0000 (14:04 +0000)
RELEASE-NOTES
includes/CoreParserFunctions.php

index 4c50b8a..65cf8fa 100644 (file)
@@ -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 ===
index 88b38fa..779685e 100644 (file)
@@ -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;