r33550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33549‎ | r33550 | r33551 >
Date:14:42, 18 April 2008
Author:simetrical
Status:old
Tags:
Comment:
Re-eliminate the fatal error I reintroduced in my last commit
Modified paths:
  • /trunk/phase3/includes/CoreParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CoreParserFunctions.php
@@ -224,15 +224,18 @@
225225 static $cache = array();
226226 $category = Category::newFromName( $name );
227227
 228+ if( !is_object( $category ) ) {
 229+ $cache[$name] = 0;
 230+ return self::formatRaw( 0, $raw );
 231+ }
 232+
228233 # Normalize name for cache
229234 $name = $category->getName();
230235
 236+ $count = 0;
231237 if( isset( $cache[$name] ) ) {
232 - return self::formatRaw( $cache[$name], $raw );
233 - }
234 -
235 - $count = 0;
236 - if( is_object( $category ) && $parser->incrementExpensiveFunctionCount() ) {
 238+ $count = $cache[$name];
 239+ } elseif( $parser->incrementExpensiveFunctionCount() ) {
237240 $count = $cache[$name] = (int)$category->getPageCount();
238241 }
239242 return self::formatRaw( $count, $raw );

Status & tagging log