summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-10-19 23:10:42 +0300
committerDmitry Stogov <dmitry@zend.com>2016-10-19 23:10:42 +0300
commit9ded1b4edbb140520e060de597267b3cb439f4c4 (patch)
treebe83393e63999b96826a538d34f4844fcac08006 /ext/json
parenteaba20999b56fd1db6c8c61b838e654b3520f84b (diff)
downloadphp-git-9ded1b4edbb140520e060de597267b3cb439f4c4.tar.gz
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) {