aboutsummaryrefslogtreecommitdiffstats
path: root/includes/profiler/ProfilerXhprof.php
diff options
context:
space:
mode:
authorBryan Davis <bd808@wikimedia.org>2014-12-18 09:29:36 -0700
committerBryan Davis <bd808@wikimedia.org>2014-12-18 09:29:36 -0700
commit57ce0b309db8ff0dbb7b53f80fdb8574c0bbd57f (patch)
tree2fc01135cb93f4570cbc9adf61375c78da4c6e1f /includes/profiler/ProfilerXhprof.php
parenta62baa2228e7068cd19d58954d6f760606dffb5e (diff)
downloadmediawikicore-57ce0b309db8ff0dbb7b53f80fdb8574c0bbd57f.tar.gz
mediawikicore-57ce0b309db8ff0dbb7b53f80fdb8574c0bbd57f.zip
xhprof: Guard against division by 0
Warning: Division by zero in /srv/mediawiki/php-1.25wmf12/includes/profiler/ProfilerXhprof.php on line 143 Change-Id: Ibb3d0ce836d30663c511809b6e1dece4baa4da92
Diffstat (limited to 'includes/profiler/ProfilerXhprof.php')
-rw-r--r--includes/profiler/ProfilerXhprof.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/profiler/ProfilerXhprof.php b/includes/profiler/ProfilerXhprof.php
index e46665749656..624433b4ddbb 100644
--- a/includes/profiler/ProfilerXhprof.php
+++ b/includes/profiler/ProfilerXhprof.php
@@ -145,7 +145,7 @@ class ProfilerXhprof extends Profiler {
}
// @note: getFunctionStats() values already in ms
- $stats['%real'] = $stats['real'] / $main['real'] * 100;
+ $stats['%real'] = $main['real'] ? $stats['real'] / $main['real'] * 100 : 0;
$stats['%cpu'] = $main['cpu'] ? $stats['cpu'] / $main['cpu'] * 100 : 0;
$stats['%memory'] = $main['memory'] ? $stats['memory'] / $main['memory'] * 100 : 0;
$profile[] = $stats; // assume no section names collide with $metrics