diff --git a/src/BSON/Iterator.c b/src/BSON/Iterator.c index 1306dbc7d..416e103b1 100644 --- a/src/BSON/Iterator.c +++ b/src/BSON/Iterator.c @@ -303,7 +303,7 @@ static void php_phongo_iterator_it_dtor(zend_object_iterator* iter) zval_ptr_dtor(&iter->data); } -static int php_phongo_iterator_it_valid(zend_object_iterator* iter) +static PHONGO_ITERATOR_VALID_RESULT php_phongo_iterator_it_valid(zend_object_iterator* iter) { php_phongo_iterator_t* intern = Z_ITERATOR_OBJ_P(&iter->data); diff --git a/src/phongo_compat.h b/src/phongo_compat.h index 1d7a7be61..5b4f01816 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -218,4 +218,11 @@ const char* zend_get_object_type_case(const zend_class_entry* ce, zend_bool uppe #define zend_get_object_type_uc(ce) zend_get_object_type_case((ce), true) #endif /* PHP_VERSION_ID < 80200 */ +/* zend_object_iterator_funcs.valid return type changed to zend_result in PHP 8.4 */ +#if PHP_VERSION_ID < 80400 +#define PHONGO_ITERATOR_VALID_RESULT int +#else +#define PHONGO_ITERATOR_VALID_RESULT zend_result +#endif + #endif /* PHONGO_COMPAT_H */