Commit: a66b5c9a289f5bfc392e1fd9ae13981e84a465ac Author: Stanislav Malyshev <[email protected]> Tue, 17 Jul 2012 14:50:07 -0700 Parents: da4e5307b9e8c083182f6d0c09fd9b272dd38932 Branches: PHP-5.4.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a66b5c9a289f5bfc392e1fd9ae13981e84a465ac Log: Revert "Fix bug #62112: number_format() is not binary safe" This reverts commit 3e62aae1b456440328af4153524e22679b84f68a. Bugs: https://bugs.php.net/62112 Changed paths: M ext/standard/math.c D ext/standard/tests/math/bug62112.phpt Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index b3e8c6f..65187f6 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1097,9 +1097,7 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho return _php_math_number_format_ex(d, dec, &dec_point, 1, &thousand_sep, 1); } -static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, - size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len, - int *result_len) +PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) { char *tmpbuf = NULL, *resbuf; char *s, *t; /* source, target */ @@ -1207,19 +1205,8 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, efree(tmpbuf); - if (result_len) { - *result_len = reslen; - } - return resbuf; } - -PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, - size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) -{ - return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len, - thousand_sep, thousand_sep_len, NULL); -} /* }}} */ /* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]]) @@ -1254,10 +1241,7 @@ PHP_FUNCTION(number_format) thousand_sep_len = 1; } - Z_TYPE_P(return_value) = IS_STRING; - Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec, - dec_point, dec_point_len, thousand_sep, thousand_sep_len, - &Z_STRLEN_P(return_value)); + RETURN_STRING(_php_math_number_format_ex(num, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len), 0); break; default: WRONG_PARAM_COUNT; diff --git a/ext/standard/tests/math/bug62112.phpt b/ext/standard/tests/math/bug62112.phpt deleted file mode 100644 index 01de35a..0000000 Binary files a/ext/standard/tests/math/bug62112.phpt and /dev/null differ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
