Allow redeclareing a protected property as public.

#
# The only known thing left at this moment is that the protected static members
# of a base class is different then the redeclared public property. I tried
# to remove both new and old static properties in the derived class and copy
# the base property with the new name. But for reasons i have to check later
# that didn't result in the expected behavior. Anyway we would need a warning
# if someone tries to change the value of a static property in a derived class.
#
This commit is contained in:
Marcus Boerger 2003-09-03 10:58:55 +00:00
parent fd5758781c
commit 1d3d396fea

View File

@ -1762,6 +1762,17 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
zend_hash_del(&ce->default_properties, child_info->name, child_info->name_length+1);
}
return 1; /* Inherit from the parent */
} else if ((child_info->flags & ZEND_ACC_PUBLIC) && (parent_info->flags & ZEND_ACC_PROTECTED)) {
char *prot_name;
int prot_name_length;
mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
if (child_info->flags & ZEND_ACC_STATIC) {
zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
} else {
zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1);
}
pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS);
}
return 0; /* Don't copy from parent */
} else {