cvs: ZendEngine2 / zend_API.c zend_compile.c zend_execute.c zend_object_handlers.c

From: Date: Wed, 03 Sep 2003 16:13:40 +0000
Subject: cvs: ZendEngine2 / zend_API.c zend_compile.c zend_execute.c zend_object_handlers.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1800@lists.php.net to get a copy of this message
helly Wed Sep 3 12:13:40 2003 EDT Modified files: /ZendEngine2 zend_API.c zend_compile.c zend_execute.c zend_object_handlers.c Log: Fix static properties. # # There's only an errormessage missing which i'll wommit as soon as i find out # how to do it best. But besides that damn message everything works now and all # inheritance rules apply. # Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.214 ZendEngine2/zend_API.c:1.215 --- ZendEngine2/zend_API.c:1.214 Tue Sep 2 16:49:42 2003 +++ ZendEngine2/zend_API.c Wed Sep 3 12:13:40 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.214 2003/09/02 20:49:42 helly Exp $ */ +/* $Id: zend_API.c,v 1.215 2003/09/03 16:13:40 helly Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -700,7 +700,6 @@ if (!class_type->constants_updated) { zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); - zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); class_type->constants_updated = 1; } Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.474 ZendEngine2/zend_compile.c:1.475 --- ZendEngine2/zend_compile.c:1.474 Wed Sep 3 06:58:55 2003 +++ ZendEngine2/zend_compile.c Wed Sep 3 12:13:40 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.474 2003/09/03 10:58:55 helly Exp $ */ +/* $Id: zend_compile.c,v 1.475 2003/09/03 16:13:40 helly Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1768,7 +1768,12 @@ 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); + zval **prop; + if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) { + (*prop)->refcount++; + zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL); + 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); } @@ -1797,6 +1802,13 @@ } +static void inherit_sttaic_prop(zval **p) +{ + (*p)->refcount++; + (*p)->is_ref = 1; +} + + void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) { if ((ce->ce_flags & ZEND_ACC_INTERFACE) @@ -1813,10 +1825,9 @@ /* Inherit properties */ zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0); + zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) inherit_sttaic_prop, NULL, sizeof(zval *), 0); zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce); - /* STATIC_MEMBERS_FIXME */ -/* zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); */ zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0); zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce); do_inherit_parent_constructor(ce); Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.534 ZendEngine2/zend_execute.c:1.535 --- ZendEngine2/zend_execute.c:1.534 Tue Sep 2 10:08:59 2003 +++ ZendEngine2/zend_execute.c Wed Sep 3 12:13:40 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.534 2003/09/02 14:08:59 helly Exp $ */ +/* $Id: zend_execute.c,v 1.535 2003/09/03 16:13:40 helly Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -722,7 +722,6 @@ FREE_OP(Ts, &opline->op1, free_op1); break; case ZEND_FETCH_STATIC: - zval_update_constant(retval, (void *) 1 TSRMLS_CC); break; } } Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.66 ZendEngine2/zend_object_handlers.c:1.67 --- ZendEngine2/zend_object_handlers.c:1.66 Tue Sep 2 10:08:59 2003 +++ ZendEngine2/zend_object_handlers.c Wed Sep 3 12:13:40 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.66 2003/09/02 14:08:59 helly Exp $ */ +/* $Id: zend_object_handlers.c,v 1.67 2003/09/03 16:13:40 helly Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -726,12 +726,7 @@ zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name); } - while (tmp_ce) { - if (zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval)==SUCCESS) { - break; - } - tmp_ce = tmp_ce->parent; - } + zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval); if (!retval) { if (silent) { @@ -741,7 +736,6 @@ } } - zval_update_constant(retval, (void *) 1 TSRMLS_CC); return retval; }

« previous php.zend-engine.cvs (#1800) next »