From 57ce0b309db8ff0dbb7b53f80fdb8574c0bbd57f Mon Sep 17 00:00:00 2001 From: Bryan Davis Date: Thu, 18 Dec 2014 09:29:36 -0700 Subject: [PATCH] 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 --- includes/profiler/ProfilerXhprof.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/profiler/ProfilerXhprof.php b/includes/profiler/ProfilerXhprof.php index e466657496..624433b4dd 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 -- 2.20.1