From: Marcus Boerger Date: Tue, 2 Sep 2003 20:49:42 +0000 (+0000) Subject: Allow redeclaring of protected properties as public (for internal classes). X-Git-Tag: RELEASE_0_7~278 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e569b5aee5ce457428455e69b646384300bfc178;p=php Allow redeclaring of protected properties as public (for internal classes). # See http://news.php.net/article.php?group=php.zend-engine.cvs&article=1737 # for the part not fixed (e.g. property redeclaration of userland classes) --- diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 27931dd51f..4b3c938ff2 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1707,6 +1707,14 @@ ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_le } break; case ZEND_ACC_PUBLIC: + if (ce->parent) { + char *prot_name; + int prot_name_length; + + mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_hash_del(target_symbol_table, prot_name, prot_name_length+1); + pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + } zend_hash_update(target_symbol_table, name, name_length+1, &property, sizeof(zval *), NULL); property_info.name = ce->type & ZEND_INTERNAL_CLASS ? zend_strndup(name, name_length) : estrndup(name, name_length); property_info.name_length = name_length;