Here is a small patch against version 3.0.6 (*NOT* against trunk) that
should fix the "now 0.00" problem.  It is simple enough:

<----cut here----->
--- functions.php.orig       Fri Dec 14 18:42:42 2007
+++ functions.php  Fri Feb  8 22:47:39 2008
@@ -422,13 +422,8 @@

 
#-------------------------------------------------------------------------------
 # If arg is entirely numeric, return it.  Otherwise, return null.
-function clean_number( $digit )
-{
-  $return_value = null;
-  if( ctype_digit( $digit ) ) {
-    $return_value = $digit;
-  }
-  return $return_value;
+function clean_number( $digit ) {
+  return is_numeric($digit) ? $digit : null;
 }

 
#-------------------------------------------------------------------------------
<-----cut here------>


The original problem is that ctype_digit is literal in what it checks
for:  digits.   So "4" would get passed, but "4.0" would not, since
that pesky non-digit "." character is there.  We actually want valid
numbers, not just digits.  is_numeric should work here, or some fancy
regex (but that's probably slower and not needed).



-- 
Jesse Becker
GPG Fingerprint -- BD00 7AA4 4483 AFCC 82D0  2720 0083 0931 9A2B 06A2

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to