com php-src: Merge branch 'PHP-5.5' into PHP-5.6: ext/json/json.c

From: Date: Sun, 22 Feb 2015 20:35:03 +0000
Subject: com php-src: Merge branch 'PHP-5.5' into PHP-5.6: ext/json/json.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85058@lists.php.net to get a copy of this message
Commit: 97d809a8a57cb7bc5833917d9e4eeddad749b53b Author: Jakub Zelenka <bukka@php.net> Sun, 22 Feb 2015 20:35:03 +0000 Parents: ffd2fda0f39e3432e274b4d49df485b59dcbef39 591dbcabe57a32550fb73223521fa1323773628f Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=97d809a8a57cb7bc5833917d9e4eeddad749b53b Log: Merge branch 'PHP-5.5' into PHP-5.6 Conflicts: ext/json/json.c Changed paths: MM ext/json/json.c Diff: diff --cc ext/json/json.c index a28f99e,16af796..f016349 --- a/ext/json/json.c +++ b/ext/json/json.c @@@ -427,25 -418,14 +427,21 @@@ static void json_escape_string(smart_st 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 *tmp; - int l = spprintf(&tmp, 0, "%.*k", (int) EG(precision), d); - smart_str_appendl(buf, tmp, l); - efree(tmp); ++ 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; } }

« previous php.cvs (#85058) next »