summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-10-19 23:12:17 +0300
committerDmitry Stogov <dmitry@zend.com>2016-10-19 23:12:17 +0300
commit65ea2500220cd5086f0532e80b944d77b65e9312 (patch)
tree4ff6fa83fd5e5db9e38c3b2e35c77fabfdffe114 /ext/json
parent67dc4de592639b9180418cee2ed1bfba838c3520 (diff)
parent9ded1b4edbb140520e060de597267b3cb439f4c4 (diff)
downloadphp-git-65ea2500220cd5086f0532e80b944d77b65e9312.tar.gz
Merge branch 'PHP-7.1'
* PHP-7.1: Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu)
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/json_encoder.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index f94674831a..473726c569 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.c
@@ -45,6 +45,10 @@ static int php_json_determine_array_type(zval *val) /* {{{ */
zend_string *key;
zend_ulong index, idx;
+ if (HT_IS_PACKED(myht) && HT_IS_WITHOUT_HOLES(myht)) {
+ return PHP_JSON_OUTPUT_ARRAY;
+ }
+
idx = 0;
ZEND_HASH_FOREACH_KEY(myht, index, key) {
if (key) {