From 1d3d396fea2c6125e90c3cb09ee68ffc98851660 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 3 Sep 2003 10:58:55 +0000 Subject: [PATCH] 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. # --- Zend/zend_compile.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d5de3a6dad..122d64a7d1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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 { -- 2.40.0