Fix division by zero in Profiler
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 9 Apr 2010 12:31:27 +0000 (12:31 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 9 Apr 2010 12:31:27 +0000 (12:31 +0000)
includes/Profiler.php

index f91fcf9..4c4aa24 100644 (file)
@@ -284,9 +284,9 @@ class Profiler {
                                $overheadInternal[] = $elapsed;
                        }
                }
-               $overheadTotal = array_sum( $overheadTotal ) / count( $overheadInternal );
-               $overheadMemory = array_sum( $overheadMemory ) / count( $overheadInternal );
-               $overheadInternal = array_sum( $overheadInternal ) / count( $overheadInternal );
+               $overheadTotal = $overheadTotal ? array_sum( $overheadTotal ) / count( $overheadInternal ) : 0;
+               $overheadMemory = $overheadMemory ? array_sum( $overheadMemory ) / count( $overheadInternal ) : 0;
+               $overheadInternal = $overheadInternal ? array_sum( $overheadInternal ) / count( $overheadInternal ) : 0;
 
                # Collate
                foreach( $this->mStack as $index => $entry ){