From d74ec0c511170f4fcd2d5db16b07a865734d94ce Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 26 May 2026 13:03:30 +0200 Subject: [PATCH] Zend: no need to fetch method name for constructor --- Zend/zend_inheritance.c | 6 +++--- Zend/zend_object_handlers.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index d70d08f5f1c4..e85b4ea42250 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -188,9 +188,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */ if (ce->constructor) { if (parent->constructor && UNEXPECTED(parent->constructor->common.fn_flags & ZEND_ACC_FINAL)) { - zend_error_noreturn(E_ERROR, "Cannot override final %s::%s() with %s::%s()", - ZSTR_VAL(parent->name), ZSTR_VAL(parent->constructor->common.function_name), - ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); + zend_error_noreturn(E_ERROR, "Cannot override final %s::__construct() with %s::__construct()", + ZSTR_VAL(parent->name), + ZSTR_VAL(ce->name)); } return; } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 571aa9e92abc..e7ddd466a51a 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -2176,12 +2176,16 @@ ZEND_API ZEND_COLD bool zend_std_unset_static_property(const zend_class_entry *c static ZEND_COLD zend_never_inline void zend_bad_constructor_call(const zend_function *constructor, const zend_class_entry *scope) /* {{{ */ { if (scope) { - zend_throw_error(NULL, "Call to %s %s::%s() from scope %s", - zend_visibility_string(constructor->common.fn_flags), ZSTR_VAL(constructor->common.scope->name), - ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(scope->name) + zend_throw_error(NULL, "Call to %s %s::__construct() from scope %s", + zend_visibility_string(constructor->common.fn_flags), + ZSTR_VAL(constructor->common.scope->name), + ZSTR_VAL(scope->name) ); } else { - zend_throw_error(NULL, "Call to %s %s::%s() from global scope", zend_visibility_string(constructor->common.fn_flags), ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name)); + zend_throw_error(NULL, "Call to %s %s::__construct() from global scope", + zend_visibility_string(constructor->common.fn_flags), + ZSTR_VAL(constructor->common.scope->name) + ); } } /* }}} */