diff options
Diffstat (limited to 'ext/json/json_encoder.c')
-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) { |