php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64695
Patch return_string_instead_of_warning revision 2013-04-23 06:27 UTC by keith at openx dot com
revision 2013-04-23 06:03 UTC by keith at openx dot com
Patch is_numeric_patch revision 2013-04-23 04:16 UTC by keith at openx dot com

Patch return_string_instead_of_warning for JSON related Bug #64695

Patch version 2013-04-23 06:03 UTC

Return to Bug #64695 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: keith@openx.com

diff --git a/ext/json/json.c b/ext/json/json.c
index ad8d08c..97aee01 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -295,18 +295,16 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
                if ((type = is_numeric_string(s, len, &p, &d, 0)) != 0) {
                        if (type == IS_LONG) {
                                smart_str_append_long(buf, p);
+                               return;
                        } else if (type == IS_DOUBLE) {
                                if (!zend_isinf(d) && !zend_isnan(d)) {
                                        char *tmp;
                                        int l = spprintf(&tmp, 0, "%.*k", (int) EG(precision), d);
                                        smart_str_appendl(buf, tmp, l);
                                        efree(tmp);
-                               } else {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", d);
-                                       smart_str_appendc(buf, '0');
+                                       return;
                                }
                        }
-                       return;
                }

        }
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Sep 25 07:01:26 2023 UTC