iliaa Sun, 08 Aug 2010 15:45:02 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=301991
Log: Additional fix for bug #52550 & fix test & warning from previous fixes Bug: http://bugs.php.net/52550 (Analyzed) integer undefined behaviors executed during "make test" Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/math.c U php/php-src/branches/PHP_5_3/ext/standard/tests/math/log_variation2.phpt U php/php-src/trunk/ext/standard/math.c U php/php-src/trunk/ext/standard/tests/math/log_variation2.phpt Modified: php/php-src/branches/PHP_5_3/ext/standard/math.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/math.c 2010-08-08 15:06:14 UTC (rev 301990) +++ php/php-src/branches/PHP_5_3/ext/standard/math.c 2010-08-08 15:45:02 UTC (rev 301991) @@ -29,6 +29,8 @@ #include <float.h> #include <stdlib.h> +#include "basic_functions.h" + /* {{{ php_intlog10abs Returns floor(log10(fabs(val))), uses fast binary search */ static inline int php_intlog10abs(double value) { @@ -127,7 +129,11 @@ double tmp_value; int precision_places; - precision_places = 14 - php_intlog10abs(value); + if ((precision_places = php_intlog10abs(value)) > 0) { + precision_places = 14 - php_intlog10abs(value); + } else { + precision_places = 14; + } f1 = php_intpow10(abs(places)); Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/math/log_variation2.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/math/log_variation2.phpt 2010-08-08 15:06:14 UTC (rev 301990) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/math/log_variation2.phpt 2010-08-08 15:45:02 UTC (rev 301991) @@ -94,7 +94,7 @@ bool(false) -- Iteration 2 -- -float(INF) +float(NAN) -- Iteration 3 -- float(0.12145441273706) @@ -135,7 +135,7 @@ bool(false) -- Iteration 13 -- -float(INF) +float(NAN) -- Iteration 14 -- @@ -143,7 +143,7 @@ bool(false) -- Iteration 15 -- -float(INF) +float(NAN) -- Iteration 16 -- Modified: php/php-src/trunk/ext/standard/math.c =================================================================== --- php/php-src/trunk/ext/standard/math.c 2010-08-08 15:06:14 UTC (rev 301990) +++ php/php-src/trunk/ext/standard/math.c 2010-08-08 15:45:02 UTC (rev 301991) @@ -29,6 +29,8 @@ #include <float.h> #include <stdlib.h> +#include "basic_functions.h" + /* {{{ php_intlog10abs Returns floor(log10(fabs(val))), uses fast binary search */ static inline int php_intlog10abs(double value) { @@ -127,7 +129,11 @@ double tmp_value; int precision_places; - precision_places = 14 - php_intlog10abs(value); + if ((precision_places = php_intlog10abs(value)) > 0) { + precision_places = 14 - php_intlog10abs(value); + } else { + precision_places = 14; + } f1 = php_intpow10(abs(places)); Modified: php/php-src/trunk/ext/standard/tests/math/log_variation2.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/math/log_variation2.phpt 2010-08-08 15:06:14 UTC (rev 301990) +++ php/php-src/trunk/ext/standard/tests/math/log_variation2.phpt 2010-08-08 15:45:02 UTC (rev 301991) @@ -94,7 +94,7 @@ bool(false) -- Iteration 2 -- -float(INF) +float(NAN) -- Iteration 3 -- float(0.12145441273706) @@ -135,7 +135,7 @@ bool(false) -- Iteration 13 -- -float(INF) +float(NAN) -- Iteration 14 -- @@ -143,7 +143,7 @@ bool(false) -- Iteration 15 -- -float(INF) +float(NAN) -- Iteration 16 --
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php