Jesse Becker wrote: > 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). > > >
Similar fix is included in the set of patches I sent a few hours ago. Only difference is I removed clean_number() in preference for the more precise clean_float(). I changed the existing clean_float() to use is_numeric() rather that the regex in Jesse's previous patch since it was a bit faster in some simple benchmarks. alex ------------------------------------------------------------------------- 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