cvs: ZendEngine2 / zend_compile.c
| From: | Marcus Boerger | Date: | Mon, 08 Sep 2003 23:25:57 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1825@lists.php.net to get a copy of this message | ||
helly Mon Sep 8 19:25:57 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Fix property inheritance where a derived class inherits a public property
and owns it as an implicit public property already (noticed by Brad).
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.481 ZendEngine2/zend_compile.c:1.482
--- ZendEngine2/zend_compile.c:1.481 Wed Sep 3 17:21:18 2003
+++ ZendEngine2/zend_compile.c Mon Sep 8 19:25:57 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.481 2003/09/03 21:21:18 helly Exp $ */
+/* $Id: zend_compile.c,v 1.482 2003/09/08 23:25:57 helly Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -1750,7 +1750,7 @@
if (parent_info->flags & ZEND_ACC_PRIVATE) {
if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey,
hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
- child_info->flags |= ZEND_ACC_CHANGED;
+ child_info->flags |= ZEND_ACC_CHANGED;
}
return 0; /* don't copy access information to child */
}
@@ -1765,13 +1765,15 @@
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags &
ZEND_ACC_PPP_MASK)) {
zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s",
ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name,
(parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
} else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) {
- /* Explicitly copy the value from the parent */
- zval **pvalue;
-
- if (zend_hash_quick_find(&parent_ce->default_properties, parent_info->name,
parent_info->name_length+1, parent_info->h, (void **) &pvalue)==SUCCESS) {
- zend_hash_quick_update(&ce->default_properties, parent_info->name,
parent_info->name_length+1, parent_info->h, pvalue, sizeof(zval *), NULL);
- (*pvalue)->refcount++;
- zend_hash_del(&ce->default_properties, child_info->name,
child_info->name_length+1);
+ if (!(parent_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) {
+ /* Explicitly copy the default value from the parent (if it has one) */
+ zval **pvalue;
+
+ if (zend_hash_quick_find(&parent_ce->default_properties, parent_info->name,
parent_info->name_length+1, parent_info->h, (void **) &pvalue)==SUCCESS) {
+ (*pvalue)->refcount++;
+ zend_hash_del(&ce->default_properties, child_info->name,
child_info->name_length+1);
+ zend_hash_quick_update(&ce->default_properties, parent_info->name,
parent_info->name_length+1, parent_info->h, pvalue, sizeof(zval *), NULL);
+ }
}
return 1; /* Inherit from the parent */
} else if ((child_info->flags & ZEND_ACC_PUBLIC) && (parent_info->flags &
ZEND_ACC_PROTECTED)) {