summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2015-02-22 20:35:03 +0000
committerJakub Zelenka <bukka@php.net>2015-02-22 20:35:03 +0000
commit97d809a8a57cb7bc5833917d9e4eeddad749b53b (patch)
tree32eddef483d310aa73d3655d23ad2355f64afc3b /ext/json/json.c
parentffd2fda0f39e3432e274b4d49df485b59dcbef39 (diff)
parent591dbcabe57a32550fb73223521fa1323773628f (diff)
downloadphp-git-97d809a8a57cb7bc5833917d9e4eeddad749b53b.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
Conflicts: ext/json/json.c
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index a28f99e10e..f016349668 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -427,25 +427,21 @@ 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 num[NUM_BUF_SIZE];
- int l;
-
- php_gcvt(d, EG(precision), '.', 'e', (char *)num);
- l = strlen(num);
- if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && l < NUM_BUF_SIZE - 2) {
- num[l++] = '.';
- num[l++] = '0';
- num[l] = '\0';
- }
- smart_str_appendl(buf, num, l);
- } 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 num[NUM_BUF_SIZE];
+ int l;
+
+ php_gcvt(d, EG(precision), '.', 'e', (char *)num);
+ l = strlen(num);
+ if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && l < NUM_BUF_SIZE - 2) {
+ num[l++] = '.';
+ num[l++] = '0';
+ num[l] = '\0';
}
+ smart_str_appendl(buf, num, l);
+ return;
}
- return;
}
}