From 6bb859250c72361e39b7a964b4f07cf119caf019 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 14 Aug 2026 21:17:36 +0100 Subject: [PATCH 1/4] Remove returns after zend_error_noreturn This might have been an issue on older MSVC but presumably it's no longer the case as zend_mark_internal_attribute has not had a return for the past 4 years and nobody complained. --- Zend/zend_enum.c | 4 ---- Zend/zend_exceptions.c | 1 - Zend/zend_interfaces.c | 1 - Zend/zend_object_handlers.c | 2 -- ext/standard/io_poll.c | 1 - 5 files changed, 9 deletions(-) diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index ecebe7a5d51b..81b1ada17ee9 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -143,8 +143,6 @@ static int zend_implement_unit_enum(zend_class_entry *interface, zend_class_entr zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); - - return FAILURE; } static int zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) @@ -153,14 +151,12 @@ static int zend_implement_backed_enum(zend_class_entry *interface, zend_class_en zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); - return FAILURE; } if (class_type->enum_backing_type == IS_UNDEF) { zend_error_noreturn(E_ERROR, "Non-backed enum %s cannot implement interface %s", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); - return FAILURE; } return SUCCESS; diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 9702a335d461..41bb084e9f1f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -83,7 +83,6 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr zend_get_object_type_uc(class_type), ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); - return FAILURE; } /* }}} */ diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 49169dfca234..1145d40d9321 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -279,7 +279,6 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en ZSTR_VAL(zend_ce_traversable->name), ZSTR_VAL(zend_ce_iterator->name), ZSTR_VAL(zend_ce_aggregate->name)); - return FAILURE; } /* }}} */ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 800f9111c3de..e60fcd5cc443 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -232,8 +232,6 @@ ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) / } zend_error_noreturn(E_ERROR, ZEND_DEBUGINFO_FUNC_NAME "() must return an array"); - - return NULL; /* Compilers are dumb and don't understand that noreturn means that the function does NOT need a return value... */ } /* }}} */ diff --git a/ext/standard/io_poll.c b/ext/standard/io_poll.c index fd20426668d2..ac20203305a4 100644 --- a/ext/standard/io_poll.c +++ b/ext/standard/io_poll.c @@ -244,7 +244,6 @@ static int php_stream_poll_handle_implement_interface(zend_class_entry *interfac { if (implementor->type == ZEND_USER_CLASS) { zend_error_noreturn(E_ERROR, "Io\\Poll\\Handle cannot be implemented by user classes"); - return FAILURE; } return SUCCESS; From 4cf40fcfd9b54c9b5ca22161f2bf8eb1a108fd20 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Wed, 30 Sep 2026 13:52:11 +0100 Subject: [PATCH 2/4] Change return type from int to zend_result --- Zend/zend.h | 2 +- Zend/zend_enum.c | 4 ++-- Zend/zend_exceptions.c | 2 +- Zend/zend_interfaces.c | 10 +++++----- ext/date/php_date.c | 2 +- ext/json/json.c | 6 +++--- ext/session/session.c | 2 +- ext/standard/io_poll.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Zend/zend.h b/Zend/zend.h index f700c3bddcbb..9d5f6d622e71 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -198,7 +198,7 @@ struct _zend_class_entry { /* handlers */ union { zend_object* (*create_object)(zend_class_entry *class_type); - int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */ + zend_result (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */ }; zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref); zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method); diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index 81b1ada17ee9..d47e631e3880 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -134,7 +134,7 @@ void zend_verify_enum(const zend_class_entry *ce) zend_verify_enum_interfaces(ce); } -static int zend_implement_unit_enum(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_unit_enum(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->ce_flags & ZEND_ACC_ENUM) { return SUCCESS; @@ -145,7 +145,7 @@ static int zend_implement_unit_enum(zend_class_entry *interface, zend_class_entr ZSTR_VAL(interface->name)); } -static int zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) { if (!(class_type->ce_flags & ZEND_ACC_ENUM)) { zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 41bb084e9f1f..351da4cd0f8d 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -61,7 +61,7 @@ ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); static zend_object_handlers default_exception_handlers; /* {{{ zend_implement_throwable */ -static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { /* zend_ce_exception and zend_ce_error may not be initialized yet when this is called (e.g when * implementing Throwable for Exception itself). Perform a manual inheritance check. */ diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 1145d40d9321..27bcdd40c379 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -256,7 +256,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c /* }}} */ /* {{{ zend_implement_traversable */ -static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) { /* Abstract class can implement Traversable only, in which case the extending class must * implement Iterator or IteratorAggregate. */ @@ -283,7 +283,7 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en /* }}} */ /* {{{ zend_implement_aggregate */ -static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_iterator)) { zend_error_noreturn(E_ERROR, @@ -325,7 +325,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr /* }}} */ /* {{{ zend_implement_iterator */ -static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_aggregate)) { zend_error_noreturn(E_ERROR, @@ -379,7 +379,7 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry /* }}} */ /* {{{ zend_implement_arrayaccess */ -static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type) { ZEND_ASSERT(!class_type->arrayaccess_funcs_ptr && "ArrayAccess funcs already set?"); zend_class_arrayaccess_funcs *funcs_ptr = class_type->type == ZEND_INTERNAL_CLASS @@ -459,7 +459,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns /* }}} */ /* {{{ zend_implement_serializable */ -static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->parent && (class_type->parent->serialize || class_type->parent->unserialize) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1795d41b27ce..7270c58d2eb5 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1703,7 +1703,7 @@ static zend_object_iterator *date_object_period_get_iterator(zend_class_entry *c return (zend_object_iterator*)iterator; } /* }}} */ -static int implement_date_interface_handler(zend_class_entry *interface, zend_class_entry *implementor) /* {{{ */ +static zend_result implement_date_interface_handler(zend_class_entry *interface, zend_class_entry *implementor) /* {{{ */ { if (implementor->type == ZEND_USER_CLASS && !instanceof_function(implementor, date_ce_date) && diff --git a/ext/json/json.c b/ext/json/json.c index 04a62f52152f..1cfc0b7e4810 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -33,7 +33,7 @@ PHP_JSON_API zend_class_entry *php_json_exception_ce; PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json) -static int php_json_implement_json_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static zend_result php_json_implement_json_serializable(zend_class_entry *interface, zend_class_entry *class_type) { class_type->ce_flags |= ZEND_ACC_USE_GUARDS; return SUCCESS; @@ -182,11 +182,11 @@ static const char *php_json_get_error_msg(php_json_error_code error_code) /* {{{ static zend_string *php_json_get_error_msg_with_location(const php_json_error_details *details) /* {{{ */ { const char *base_msg = php_json_get_error_msg(details->code); - + if (details->line > 0 && details->column > 0) { return zend_strpprintf(0, "%s near location %" PRIu64 ":%" PRIu64, base_msg, details->line, details->column); } - + return zend_string_init(base_msg, strlen(base_msg), 0); } /* }}} */ diff --git a/ext/session/session.c b/ext/session/session.c index ef97f856499f..a87ff767b4c5 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2954,7 +2954,7 @@ static bool session_interfaces_include(const zend_class_entry *ce, const zend_cl return false; } -static int session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) { +static zend_result session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) { if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("create_sid")) && !session_interfaces_include(class, php_session_id_iface_entry)) { zend_error(E_WARNING, diff --git a/ext/standard/io_poll.c b/ext/standard/io_poll.c index ac20203305a4..17b998e8d559 100644 --- a/ext/standard/io_poll.c +++ b/ext/standard/io_poll.c @@ -240,7 +240,7 @@ static php_poll_handle_ops php_stream_poll_handle_ops = { }; /* Handle interface internal only */ -static int php_stream_poll_handle_implement_interface(zend_class_entry *interface, zend_class_entry *implementor) +static zend_result php_stream_poll_handle_implement_interface(zend_class_entry *interface, zend_class_entry *implementor) { if (implementor->type == ZEND_USER_CLASS) { zend_error_noreturn(E_ERROR, "Io\\Poll\\Handle cannot be implemented by user classes"); From 4f786978a43f89732deca294bc9a012f5af0ef68 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Wed, 30 Sep 2026 23:05:15 +0100 Subject: [PATCH 3/4] Voidify interface_gets_implemented --- UPGRADING.INTERNALS | 1 + Zend/zend.h | 2 +- Zend/zend_enum.c | 8 +++----- Zend/zend_exceptions.c | 4 ++-- Zend/zend_inheritance.c | 4 ++-- Zend/zend_interfaces.c | 29 ++++++++++++----------------- ext/date/php_date.c | 4 +--- ext/json/json.c | 3 +-- ext/session/session.c | 3 +-- ext/standard/io_poll.c | 4 +--- 10 files changed, 25 insertions(+), 37 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 08f23f690fbe..ed890c89c411 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -35,6 +35,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES This new signature covers the most common parameters used with zend_is_callable_ex(). - Removed zend_hrtime_posix_clock_id. zend_hrtime() always uses CLOCK_MONOTONIC on POSIX platforms. +- Function pointer signature for interface_gets_implemented has been made void. - Added a new zend_object_copy() function which increases the refcount of a zend_object* and returns it. Allowing more descriptive code rather than doing an assignment followed by GC_ADDREF(). diff --git a/Zend/zend.h b/Zend/zend.h index 9d5f6d622e71..4fcbda361fa9 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -198,7 +198,7 @@ struct _zend_class_entry { /* handlers */ union { zend_object* (*create_object)(zend_class_entry *class_type); - zend_result (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */ + void (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */ }; zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref); zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method); diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index d47e631e3880..84955c27f643 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -134,10 +134,10 @@ void zend_verify_enum(const zend_class_entry *ce) zend_verify_enum_interfaces(ce); } -static zend_result zend_implement_unit_enum(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_unit_enum(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->ce_flags & ZEND_ACC_ENUM) { - return SUCCESS; + return; } zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", @@ -145,7 +145,7 @@ static zend_result zend_implement_unit_enum(zend_class_entry *interface, zend_cl ZSTR_VAL(interface->name)); } -static zend_result zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) { if (!(class_type->ce_flags & ZEND_ACC_ENUM)) { zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", @@ -158,8 +158,6 @@ static zend_result zend_implement_backed_enum(zend_class_entry *interface, zend_ ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); } - - return SUCCESS; } void zend_register_enum_ce(void) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 351da4cd0f8d..0af55b7fbe9b 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -61,7 +61,7 @@ ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); static zend_object_handlers default_exception_handlers; /* {{{ zend_implement_throwable */ -static zend_result zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { /* zend_ce_exception and zend_ce_error may not be initialized yet when this is called (e.g when * implementing Throwable for Exception itself). Perform a manual inheritance check. */ @@ -71,7 +71,7 @@ static zend_result zend_implement_throwable(zend_class_entry *interface, zend_cl } if (zend_string_equals_literal(root->name, "Exception") || zend_string_equals_literal(root->name, "Error")) { - return SUCCESS; + return; } bool can_extend = (class_type->ce_flags & ZEND_ACC_ENUM) == 0; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 99b88c90f913..22787d6af302 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1576,8 +1576,8 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ { - if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce) == FAILURE) { - zend_error_noreturn(E_CORE_ERROR, "%s %s could not implement interface %s", zend_get_object_type_uc(ce), ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); + if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented) { + iface->interface_gets_implemented(iface, ce); } /* This should be prevented by the class lookup logic. */ ZEND_ASSERT(ce != iface); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 27bcdd40c379..cd12f3dbea0d 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -256,12 +256,12 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c /* }}} */ /* {{{ zend_implement_traversable */ -static zend_result zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type) { /* Abstract class can implement Traversable only, in which case the extending class must * implement Iterator or IteratorAggregate. */ if (class_type->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) { - return SUCCESS; + return; } /* Check that class_type implements at least one of 'IteratorAggregate' or 'Iterator' */ @@ -269,7 +269,7 @@ static zend_result zend_implement_traversable(zend_class_entry *interface, zend_ ZEND_ASSERT(class_type->ce_flags & ZEND_ACC_RESOLVED_INTERFACES); for (uint32_t i = 0; i < class_type->num_interfaces; i++) { if (class_type->interfaces[i] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) { - return SUCCESS; + return; } } } @@ -283,7 +283,7 @@ static zend_result zend_implement_traversable(zend_class_entry *interface, zend_ /* }}} */ /* {{{ zend_implement_aggregate */ -static zend_result zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_iterator)) { zend_error_noreturn(E_ERROR, @@ -308,24 +308,23 @@ static zend_result zend_implement_aggregate(zend_class_entry *interface, zend_cl /* get_iterator was explicitly assigned for an internal class. */ if (!class_type->parent || class_type->parent->get_iterator != class_type->get_iterator) { ZEND_ASSERT(class_type->type == ZEND_INTERNAL_CLASS); - return SUCCESS; + return; } /* The getIterator() method has not been overwritten, use inherited get_iterator(). */ if (funcs_ptr->zf_new_iterator->common.scope != class_type) { - return SUCCESS; + return; } /* getIterator() has been overwritten, switch to zend_user_it_get_new_iterator. */ } class_type->get_iterator = zend_user_it_get_new_iterator; - return SUCCESS; } /* }}} */ /* {{{ zend_implement_iterator */ -static zend_result zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type) { if (zend_class_implements_interface(class_type, zend_ce_aggregate)) { zend_error_noreturn(E_ERROR, @@ -357,7 +356,7 @@ static zend_result zend_implement_iterator(zend_class_entry *interface, zend_cla if (!class_type->parent || class_type->parent->get_iterator != class_type->get_iterator) { /* get_iterator was explicitly assigned for an internal class. */ ZEND_ASSERT(class_type->type == ZEND_INTERNAL_CLASS); - return SUCCESS; + return; } /* None of the Iterator methods have been overwritten, use inherited get_iterator(). */ @@ -366,7 +365,7 @@ static zend_result zend_implement_iterator(zend_class_entry *interface, zend_cla funcs_ptr->zf_key->common.scope != class_type && funcs_ptr->zf_current->common.scope != class_type && funcs_ptr->zf_next->common.scope != class_type) { - return SUCCESS; + return; } /* One of the Iterator methods has been overwritten, @@ -374,12 +373,11 @@ static zend_result zend_implement_iterator(zend_class_entry *interface, zend_cla } class_type->get_iterator = zend_user_it_get_iterator; - return SUCCESS; } /* }}} */ /* {{{ zend_implement_arrayaccess */ -static zend_result zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type) { ZEND_ASSERT(!class_type->arrayaccess_funcs_ptr && "ArrayAccess funcs already set?"); zend_class_arrayaccess_funcs *funcs_ptr = class_type->type == ZEND_INTERNAL_CLASS @@ -395,8 +393,6 @@ static zend_result zend_implement_arrayaccess(zend_class_entry *interface, zend_ &class_type->function_table, "offsetset", sizeof("offsetset") - 1); funcs_ptr->zf_offsetunset = zend_hash_str_find_ptr( &class_type->function_table, "offsetunset", sizeof("offsetunset") - 1); - - return SUCCESS; } /* }}} */ @@ -459,12 +455,12 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns /* }}} */ /* {{{ zend_implement_serializable */ -static zend_result zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static void zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type) { if (class_type->parent && (class_type->parent->serialize || class_type->parent->unserialize) && !zend_class_implements_interface(class_type->parent, zend_ce_serializable)) { - return FAILURE; + zend_error_noreturn(E_CORE_ERROR, "%s %s could not implement interface %s", zend_get_object_type_uc(class_type), ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name)); } if (!class_type->serialize) { class_type->serialize = zend_user_serialize; @@ -480,7 +476,6 @@ static zend_result zend_implement_serializable(zend_class_entry *interface, zend "During inheritance of %s, while implementing Serializable", ZSTR_VAL(class_type->name)); } } - return SUCCESS; } /* }}}*/ diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 7270c58d2eb5..ea77d9867cf2 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1703,7 +1703,7 @@ static zend_object_iterator *date_object_period_get_iterator(zend_class_entry *c return (zend_object_iterator*)iterator; } /* }}} */ -static zend_result implement_date_interface_handler(zend_class_entry *interface, zend_class_entry *implementor) /* {{{ */ +static void implement_date_interface_handler(zend_class_entry *interface, zend_class_entry *implementor) /* {{{ */ { if (implementor->type == ZEND_USER_CLASS && !instanceof_function(implementor, date_ce_date) && @@ -1711,8 +1711,6 @@ static zend_result implement_date_interface_handler(zend_class_entry *interface, ) { zend_error_noreturn(E_ERROR, "DateTimeInterface can't be implemented by user classes"); } - - return SUCCESS; } /* }}} */ static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ diff --git a/ext/json/json.c b/ext/json/json.c index 1cfc0b7e4810..dbae11c98f40 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -33,10 +33,9 @@ PHP_JSON_API zend_class_entry *php_json_exception_ce; PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json) -static zend_result php_json_implement_json_serializable(zend_class_entry *interface, zend_class_entry *class_type) +static void php_json_implement_json_serializable(zend_class_entry *interface, zend_class_entry *class_type) { class_type->ce_flags |= ZEND_ACC_USE_GUARDS; - return SUCCESS; } /* {{{ MINIT */ diff --git a/ext/session/session.c b/ext/session/session.c index a87ff767b4c5..d764bd5689fd 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2954,7 +2954,7 @@ static bool session_interfaces_include(const zend_class_entry *ce, const zend_cl return false; } -static zend_result session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) { +static void session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) { if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("create_sid")) && !session_interfaces_include(class, php_session_id_iface_entry)) { zend_error(E_WARNING, @@ -2967,7 +2967,6 @@ static zend_result session_handler_interface_gets_implemented(zend_class_entry * "Class %s implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0", ZSTR_VAL(class->name)); } - return SUCCESS; } static PHP_MINIT_FUNCTION(session) diff --git a/ext/standard/io_poll.c b/ext/standard/io_poll.c index 17b998e8d559..abb7543d8f30 100644 --- a/ext/standard/io_poll.c +++ b/ext/standard/io_poll.c @@ -240,13 +240,11 @@ static php_poll_handle_ops php_stream_poll_handle_ops = { }; /* Handle interface internal only */ -static zend_result php_stream_poll_handle_implement_interface(zend_class_entry *interface, zend_class_entry *implementor) +static void php_stream_poll_handle_implement_interface(zend_class_entry *interface, zend_class_entry *implementor) { if (implementor->type == ZEND_USER_CLASS) { zend_error_noreturn(E_ERROR, "Io\\Poll\\Handle cannot be implemented by user classes"); } - - return SUCCESS; } /* Object Creation Functions */ From 21eb8b0d9758a50972a7d0c8b54a7f43881f0a1e Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Thu, 1 Oct 2026 13:31:40 +0100 Subject: [PATCH 4/4] Explain the consequence --- UPGRADING.INTERNALS | 1 + 1 file changed, 1 insertion(+) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index ed890c89c411..e16a7bdae805 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -36,6 +36,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES - Removed zend_hrtime_posix_clock_id. zend_hrtime() always uses CLOCK_MONOTONIC on POSIX platforms. - Function pointer signature for interface_gets_implemented has been made void. + Implementations are expected to use zend_error_noreturn upon failure. - Added a new zend_object_copy() function which increases the refcount of a zend_object* and returns it. Allowing more descriptive code rather than doing an assignment followed by GC_ADDREF().