From: Zeev Suraski Date: Wed, 12 Feb 2003 16:28:34 +0000 (+0000) Subject: Fix declaration of class members that don't have an explicit access modifier X-Git-Tag: RELEASE_0_5~1078 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c2a1255cdc84805f43067b994fd2349b66cc7a8;p=php Fix declaration of class members that don't have an explicit access modifier --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 3fd9e8f49b..e1eaafdbea 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -919,7 +919,7 @@ int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier) } -void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, zend_uint fn_flags TSRMLS_DC) +void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, zend_uint fn_flags TSRMLS_DC) { zend_op_array op_array; char *name = function_name->u.constant.value.str.val; @@ -960,10 +960,15 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zend_error(E_COMPILE_ERROR, "Cannot redeclare %s()", name); } } + if (fn_flags & ZEND_ACC_ABSTRACT) { CG(active_class_entry)->ce_flags |= ZEND_ACC_ABSTRACT; } + if (!(fn_flags & ZEND_ACC_PPP_MASK)) { + fn_flags |= ZEND_ACC_PUBLIC; + } + if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))) { 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)))) { @@ -2196,6 +2201,10 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract"); } + if (!(access_type & ZEND_ACC_PPP_MASK)) { + access_type |= ZEND_ACC_PUBLIC; + } + if (zend_hash_find(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, (void **) &existing_property_info)==SUCCESS) { if (!(existing_property_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) { zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val);