Skip to content

Commit 1550228

Browse files
author
Mikhail Galanin
committed
PHP8 Compatibility: fixed array-list detection
1 parent 55148d8 commit 1550228

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/tarantool_msgpack.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ void php_mp_pack_array(smart_string *str, size_t len) {
9696
int php_mp_is_hash(zval *val) {
9797
HashTable *ht = Z_ARRVAL_P(val);
9898
int count = zend_hash_num_elements(ht);
99-
if (count != ht->nNextFreeElement) {
99+
if (count == 0) {
100+
// empty array considered as list
101+
return 0;
102+
} else if (count != ht->nNextFreeElement) {
100103
return 1;
101104
} else {
102105
HashPosition pos = {0};

0 commit comments

Comments
 (0)