Permalink
Browse files

Fix division by zero when there is no hit

  • Loading branch information...
1 parent 62488ba commit a91106767ec43c0b9d8feee884db8a4e5dbeec66 @gierschv gierschv 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 a911067

Please sign in to comment.