mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
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:
parent
fd5758781c
commit
1d3d396fea
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user