r64788 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64787‎ | r64788 | r64789 >
Date:12:31, 9 April 2010
Author:catrope
Status:ok
Tags:
Comment:
Fix division by zero in Profiler
Modified paths:
  • /trunk/phase3/includes/Profiler.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Profiler.php
@@ -284,9 +284,9 @@
285285 $overheadInternal[] = $elapsed;
286286 }
287287 }
288 - $overheadTotal = array_sum( $overheadTotal ) / count( $overheadInternal );
289 - $overheadMemory = array_sum( $overheadMemory ) / count( $overheadInternal );
290 - $overheadInternal = array_sum( $overheadInternal ) / count( $overheadInternal );
 288+ $overheadTotal = $overheadTotal ? array_sum( $overheadTotal ) / count( $overheadInternal ) : 0;
 289+ $overheadMemory = $overheadMemory ? array_sum( $overheadMemory ) / count( $overheadInternal ) : 0;
 290+ $overheadInternal = $overheadInternal ? array_sum( $overheadInternal ) / count( $overheadInternal ) : 0;
291291
292292 # Collate
293293 foreach( $this->mStack as $index => $entry ){

Status & tagging log