diff options
author | Jakub Zelenka <bukka@php.net> | 2015-02-22 20:22:47 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2015-02-22 20:22:47 +0000 |
commit | 591dbcabe57a32550fb73223521fa1323773628f (patch) | |
tree | bdced12769973f9abcdc0569e000f7997854cd61 /ext/json/json.c | |
parent | 7ea5b3f71cb7291f88659ecf810916c34b1b6f4a (diff) | |
download | php-git-591dbcabe57a32550fb73223521fa1323773628f.tar.gz |
Fix bug #64695 (JSON_NUMERIC_CHECK has issues with strings that are numbers plus the letter e)
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index 5b71eb06f6..16af796145 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -418,18 +418,14 @@ 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); - } 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 { - JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; - smart_str_appendc(buf, '0'); - } + return; + } else if (type == IS_DOUBLE && !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); + return; } - return; } } |