]> granicus.if.org Git - php/commitdiff
Fix declaration of class members that don't have an explicit access modifier
authorZeev Suraski <zeev@php.net>
Wed, 12 Feb 2003 16:28:34 +0000 (16:28 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 12 Feb 2003 16:28:34 +0000 (16:28 +0000)
Zend/zend_compile.c

index 3fd9e8f49ba5593173c4fc0504546613fd3dc811..e1eaafdbea2761f8c7d65478317373010ffe7129 100644 (file)
@@ -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);