diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-12-14 00:37:19 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-12-14 00:37:19 +0000 |
commit | 6d7cac7731e12a6ca6758501f0970de9040e8fd1 (patch) | |
tree | 2f43722f83391b41d8bcd0e0660fd0a21f6b0598 /ext/standard/math.c | |
parent | 419bbffeef1d8ddc829d696b949fd7788b62cdd8 (diff) | |
download | php-git-6d7cac7731e12a6ca6758501f0970de9040e8fd1.tar.gz |
Fixed bug #28228 (NULL decimal separator is not being handled correctly).
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r-- | ext/standard/math.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c index 3543e22213..289c3c491b 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1141,17 +1141,22 @@ PHP_FUNCTION(number_format) } convert_to_double_ex(num); convert_to_long_ex(dec); - convert_to_string_ex(d_p); - convert_to_string_ex(t_s); - if (Z_STRLEN_PP(d_p)==1) { - dec_point=Z_STRVAL_PP(d_p)[0]; - } else if (Z_STRLEN_PP(d_p)==0) { - dec_point=0; + + if (Z_TYPE_PP(d_p) != IS_NULL) { + convert_to_string_ex(d_p); + if (Z_STRLEN_PP(d_p)==1) { + dec_point=Z_STRVAL_PP(d_p)[0]; + } else if (Z_STRLEN_PP(d_p)==0) { + dec_point=0; + } } - if (Z_STRLEN_PP(t_s)==1) { - thousand_sep=Z_STRVAL_PP(t_s)[0]; - } else if(Z_STRLEN_PP(t_s)==0) { - thousand_sep=0; + if (Z_TYPE_PP(t_s) != IS_NULL) { + convert_to_string_ex(t_s); + if (Z_STRLEN_PP(t_s)==1) { + thousand_sep=Z_STRVAL_PP(t_s)[0]; + } else if(Z_STRLEN_PP(t_s)==0) { + thousand_sep=0; + } } RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep), 0); break; |