]> granicus.if.org Git - php/commitdiff
Allow redeclaring of protected properties as public (for internal classes).
authorMarcus Boerger <helly@php.net>
Tue, 2 Sep 2003 20:49:42 +0000 (20:49 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 2 Sep 2003 20:49:42 +0000 (20:49 +0000)
# 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)

Zend/zend_API.c

index 27931dd51f50095f371d3a95fea4475c7dd98c96..4b3c938ff27df509976136bf4d8fafb9952b8626 100644 (file)
@@ -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;