From: Aryeh Gregor Date: Fri, 18 Apr 2008 14:42:24 +0000 (+0000) Subject: Re-eliminate the fatal error I reintroduced in my last commit X-Git-Tag: 1.31.0-rc.0~48202 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=eebef8104fdd2b21a246c161754d61a462320750;p=lhc%2Fweb%2Fwiklou.git Re-eliminate the fatal error I reintroduced in my last commit --- diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index 7602da229a..7cd083e031 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -224,15 +224,18 @@ class CoreParserFunctions { static $cache = array(); $category = Category::newFromName( $name ); + if( !is_object( $category ) ) { + $cache[$name] = 0; + return self::formatRaw( 0, $raw ); + } + # Normalize name for cache $name = $category->getName(); - if( isset( $cache[$name] ) ) { - return self::formatRaw( $cache[$name], $raw ); - } - $count = 0; - if( is_object( $category ) && $parser->incrementExpensiveFunctionCount() ) { + if( isset( $cache[$name] ) ) { + $count = $cache[$name]; + } elseif( $parser->incrementExpensiveFunctionCount() ) { $count = $cache[$name] = (int)$category->getPageCount(); } return self::formatRaw( $count, $raw );