]> 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:38:35 +0000 (00:38 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 14 Dec 2004 00:38:35 +0000 (00:38 +0000)
NEWS
ext/standard/math.c

diff --git a/NEWS b/NEWS
index 7d8b6cfb780afecbdcf0ca06a57cb6511603e117..bd0f0eaf7e671b3857fece14336d188255fa71f5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -86,6 +86,8 @@ PHP                                                                        NEWS
 - Fixed bug #28598 (Lost support for MS Symbol fonts). (Pierre)
 - Fixed bug #28220 (mb_strwidth() returns wrong width values for some hangul
   characters). (Moriyoshi)
+- Fixed bug #28228 (NULL decimal separator is not being handled correctly).
+  (Ilia)
 - Fixed bug #28209 (strtotime("now")). (Derick)
 - Fixed bug #27798 (private / protected variables not exposed by 
   get_object_vars() inside class). (Marcus)
index 1ab898569b7caa76cb8d362fd009f07912bdb4c5..8278f1a2777ddb4a2aad87c6f608a6875233874f 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;