--- php-4.3.0-dev-zend2-alpha1/Zend/zend_compile.c Tue Apr 23 20:06:53 2002 +++ php-4.3.0-dev-zend2-alpha1pl2/Zend/zend_compile.c Sat Jun 22 21:16:00 2002 @@ -1475,19 +1476,19 @@ } } - -static void do_inherit_parent_constructor(zend_class_entry *ce) + +static void do_inherit_parent_special_methods(zend_class_entry *ce) { - if (ce->parent - && !zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) { - zend_function *function; - - if (zend_hash_find(&ce->parent->function_table, ce->parent->name, ce->parent->name_length+1, (void **) &function)==SUCCESS) { - /* inherit parent's constructor */ - zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function, sizeof(zend_function), NULL); - function_add_ref(function); - } - } + + if (ce->parent) { + if (!ce->constructor) + ce->constructor = ce->parent->constructor; + + if (!ce->destructor) + ce->destructor = ce->parent->destructor; + + /* FIXME: What to do with clone? */ + } } void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) @@ -1508,7 +1509,7 @@ ce->handle_property_set = parent_ce->handle_property_set; if (!ce->handle_function_call) ce->handle_function_call = parent_ce->handle_function_call; - do_inherit_parent_constructor(ce); + do_inherit_parent_special_methods(ce); } static void create_class(HashTable *class_table, char *name, int name_length, zend_class_entry **ce) @@ -2129,7 +2130,7 @@ void zend_do_end_class_declaration(znode *class_token TSRMLS_DC) { - do_inherit_parent_constructor(CG(active_class_entry)); + do_inherit_parent_special_methods(CG(active_class_entry)); CG(active_class_entry) = class_token->u.previously_active_class_entry; if (CG(active_ce_parent_class_name).value.str.val) { efree(CG(active_ce_parent_class_name).value.str.val);