]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #28228 (NULL decimal separator is not being handled correctly).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 14 Dec 2004 00:40:01 +0000 (00:40 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 14 Dec 2004 00:40:01 +0000 (00:40 +0000)
NEWS
ext/standard/math.c

diff --git a/NEWS b/NEWS
index 45c9ff166cc6a6fdd4c33b5ba0bfa76d0dd943b3..e3e0d27bc103f9622d140c4658fcae9a3cfedff3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP 4                                                                      NEWS
 - Fixed bug #31024 (Crash in fgetcsv() with negative length). (Ilia)
 - Fixed bug #31019 (Logic error mssql library checking). (Frank)
 - Fixed bug #28598 (Lost support for MS Symbol fonts). (Pierre)
+- Fixed bug #28228 (NULL decimal separator is not being handled correctly).
+  (Ilia)
 
 07 Dec 2004, Version 4.3.10RC2
 - Fixed bug #30995 (snmp extension does not build with net-snmp 5.2). (Ilia)
index 8deab246850184a331128bc8727d36fbf955ddf8..320518ad3734e33e7999aa3f20485d92664e249c 100644 (file)
@@ -1136,17 +1136,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;