Permalink
Browse files

Merge pull request #4 from gierschv/master

Fix division by zero in stats command when there is no hit
  • Loading branch information...
2 parents 62488ba + a911067 commit 9c66cf8357bd9231bc3762e8c18976db9ac1249b @beryllium committed May 23, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Command/CacheClientStatsCommand.php
@@ -91,7 +91,8 @@ public function formatStats( $stats, $debug = false )
$out .= "\tOpen Connections: " . $item[ 'curr_connections' ] . "\n";
$out .= "\tHits: " . $item[ 'get_hits' ] . "\n";
$out .= "\tMisses: " . $item[ 'get_misses' ] . "\n";
- $out .= "\tHelpfulness: " . round( $item[ 'get_hits' ] / ( $item[ 'get_hits' ] + $item[ 'get_misses' ] ) * 100, 2 ) . "%\n";
+ if ( $item[ 'get_hits' ] + $item[ 'get_misses' ] > 0 )
+ $out .= "\tHelpfulness: " . round( $item[ 'get_hits' ] / ( $item[ 'get_hits' ] + $item[ 'get_misses' ] ) * 100, 2 ) . "%\n";
if ( $debug )
{

0 comments on commit 9c66cf8

Please sign in to comment.