diff --git a/src/php_tarantool.h b/src/php_tarantool.h index db46137..acc39bc 100644 --- a/src/php_tarantool.h +++ b/src/php_tarantool.h @@ -29,6 +29,13 @@ # define smart_string_free_ex(...) smart_str_free_ex(__VA_ARGS__) #endif +#if PHP_VERSION_ID >= 80000 +/* These macroses were removed in PHP 8. */ +# define TSRMLS_CC +# define TSRMLS_DC +# define TSRMLS_FETCH() +#endif /* PHP_VERSION_ID >= 80000 */ + #if PHP_VERSION_ID < 70300 # define GC_SET_REFCOUNT(p, rc) do { \ GC_REFCOUNT((p)) = (rc); \ diff --git a/src/tarantool_msgpack.c b/src/tarantool_msgpack.c index 39f904e..4d95de4 100644 --- a/src/tarantool_msgpack.c +++ b/src/tarantool_msgpack.c @@ -96,7 +96,10 @@ void php_mp_pack_array(smart_string *str, size_t len) { int php_mp_is_hash(zval *val) { HashTable *ht = Z_ARRVAL_P(val); int count = zend_hash_num_elements(ht); - if (count != ht->nNextFreeElement) { + if (count == 0) { + /* An empty array is considered as a list. */ + return 0; + } else if (count != ht->nNextFreeElement) { return 1; } else { HashPosition pos = {0};