]> granicus.if.org Git - php/commitdiff
Fix a couple of aggregation bugs:
authorAndrei Zmievski <andrei@php.net>
Wed, 4 Jun 2003 18:57:53 +0000 (18:57 +0000)
committerAndrei Zmievski <andrei@php.net>
Wed, 4 Jun 2003 18:57:53 +0000 (18:57 +0000)
- 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

index 90f60f964f3a987554b89f4ac190b70ce75ace36..f344311b83e93182f59438333d354fe22435a5c9 100644 (file)
@@ -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.