From baf849364c848ff1b082f29d9adb0857aedec421 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Mon, 20 Sep 2021 21:33:10 +0800 Subject: [PATCH] Fix compilation for PHP 8.1 Signed-off-by: Jack Cherng --- src/common.h | 11 +++++++++++ src/php/arginfo.h | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index cd90519..5ff8cd4 100644 --- a/src/common.h +++ b/src/common.h @@ -222,6 +222,17 @@ int name##_unserialize( \ zend_ce_error, \ "Immutable objects may not be changed") +// https://bugs.php.net/bug.php?id=80816 +#if PHP_VERSION_ID >= 80100 +#define spl_ce_Aggregate zend_ce_aggregate +#define spl_ce_ArrayAccess zend_ce_arrayaccess +#define spl_ce_Countable zend_ce_countable +#define spl_ce_Iterator zend_ce_iterator +#define spl_ce_Serializable zend_ce_serializable +#define spl_ce_Stringable zend_ce_stringable +#define spl_ce_Traversable zend_ce_traversable +#endif + /** * */ diff --git a/src/php/arginfo.h b/src/php/arginfo.h index 9b2e4b8..7551002 100644 --- a/src/php/arginfo.h +++ b/src/php/arginfo.h @@ -110,7 +110,11 @@ ZEND_END_ARG_INFO() { (const char*)(zend_uintptr_t)(required_num_args), class_name, IS_OBJECT, pass_by_ref, allow_null, 0 }, #endif -#if PHP_VERSION_ID >= 80000 +#if PHP_VERSION_ID >= 80100 +#define DS_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, pass_by_ref, required_num_args, type, allow_null) \ + static const zend_internal_arg_info arginfo_##name[] = { \ + { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0, 0)) }, +#elif PHP_VERSION_ID >= 80000 #define DS_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, pass_by_ref, required_num_args, type, allow_null) \ static const zend_internal_arg_info arginfo_##name[] = { \ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },