From fd5d1094d34ec29a978f86465c01a2982d0f4968 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Wed, 4 Jun 2003 18:57:53 +0000 Subject: [PATCH] Fix a couple of aggregation bugs: - Needed to add a reference to a function when copying (#23574) - Due to pecularity of ZE1 object zvals could be re-used, so we always set the new class entry explicitly. --- ext/standard/aggregation.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/standard/aggregation.c b/ext/standard/aggregation.c index 90f60f964f..f344311b83 100644 --- a/ext/standard/aggregation.c +++ b/ext/standard/aggregation.c @@ -134,7 +134,7 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i */ if (zend_hash_add(&ce->function_table, func_name, func_name_len, (void*)function, sizeof(zend_function), NULL) == SUCCESS) { - + function_add_ref(function); add_next_index_stringl(aggr_methods, func_name, func_name_len-1, 1); } @@ -402,8 +402,6 @@ static void aggregate(INTERNAL_FUNCTION_PARAMETERS, int aggr_what, int aggr_type * and stuff this where it belongs so we don't have to work so hard next * time. */ - /* OBJECT FIXME!! won't work with non-standard objects */ - (Z_OBJ_P(obj))->ce = new_ce; aggr_info_new.new_ce = new_ce; MAKE_STD_ZVAL(aggr_info_new.aggr_members); array_init(aggr_info_new.aggr_members); @@ -418,6 +416,9 @@ static void aggregate(INTERNAL_FUNCTION_PARAMETERS, int aggr_what, int aggr_type new_ce = aggr_info->new_ce; } + /* OBJECT FIXME!! won't work with non-standard objects */ + (Z_OBJ_P(obj))->ce = new_ce; + /* * This should be easy to understand. If not, ask Rasmus about it at his * next tutorial. -- 2.50.1