diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-10-19 23:10:42 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-10-19 23:10:42 +0300 |
commit | 9ded1b4edbb140520e060de597267b3cb439f4c4 (patch) | |
tree | be83393e63999b96826a538d34f4844fcac08006 /ext/json | |
parent | eaba20999b56fd1db6c8c61b838e654b3520f84b (diff) | |
download | php-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.c | 4 |
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) { |