cvs: ZendEngine2 / zend_compile.c
| From: | Marcus Boerger | Date: | Wed, 03 Sep 2003 10:58:56 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1799@lists.php.net to get a copy of this message | ||
helly Wed Sep 3 06:58:56 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
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.
#
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.473 ZendEngine2/zend_compile.c:1.474
--- ZendEngine2/zend_compile.c:1.473 Wed Sep 3 04:39:43 2003
+++ ZendEngine2/zend_compile.c Wed Sep 3 06:58:55 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.473 2003/09/03 08:39:43 zeev Exp $ */
+/* $Id: zend_compile.c,v 1.474 2003/09/03 10:58:55 helly Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -1762,6 +1762,17 @@
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 {