From 1a7c0d52dc31623bd88a87e03849ab915275c49d Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sat, 1 Mar 2003 14:57:49 +0000 Subject: [PATCH] =?utf8?q?-=20Make=20=5F=5Fconstruct()=20have=20higher=20p?= =?utf8?q?riority=20than=20class=20name=20functions=20-=20for=20constructo?= =?utf8?q?rs.=20-=20Fix=20problem=20with=20the=20engine=20allowing=20final?= =?utf8?q?/abstract=20for=20the=20same=20method.=20-=20Both=20patches=20ar?= =?utf8?q?e=20by=20Marcus=20B=C3=B6rger.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Zend/zend_compile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 180f3aaec4..70bdf25dc3 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -916,6 +916,9 @@ int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier) && ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) != (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK))) { zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); } + if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { + zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); + } if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) == (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) { zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on a private class member"); } @@ -974,7 +977,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n fn_flags |= ZEND_ACC_PUBLIC; } - if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))) { + if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len)) && !CG(active_class_entry)->constructor) { CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) { CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); -- 2.50.1