cvs: ZendEngine2 / zend_compile.c zend_objects.c

From: Date: Tue, 03 Feb 2004 12:36:13 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_objects.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2300@lists.php.net to get a copy of this message
zeev Tue Feb 3 07:36:13 2004 EDT Modified files: /ZendEngine2 zend_compile.c zend_objects.c Log: Perform a bitwise copy of the object even when __clone() is defined. __clone() is back to not requiring any arguments, as $that is no longer needed ($this already contains a copy of the original object, by the time we __clone() is executed). Calling the parent clone is done using parent::__clone() http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.525&r2=1.526&ty=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.525 ZendEngine2/zend_compile.c:1.526 --- ZendEngine2/zend_compile.c:1.525 Tue Feb 3 07:17:09 2004 +++ ZendEngine2/zend_compile.c Tue Feb 3 07:36:13 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.525 2004/02/03 12:17:09 zeev Exp $ */ +/* $Id: zend_compile.c,v 1.526 2004/02/03 12:36:13 zeev Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1112,8 +1112,8 @@ if (CG(active_class_entry) && !strcmp(CG(active_op_array)->function_name, ZEND_CLONE_FUNC_NAME) - && (CG(active_op_array)->num_args != 1 || strcmp(CG(active_op_array)->arg_info[0].name, "that")!=0)) { - zend_error(E_COMPILE_ERROR, "The clone method must be declared as __clone($that)"); + && CG(active_op_array)->num_args != 0) { + zend_error(E_COMPILE_ERROR, "The clone method cannot accept any arguments"); } CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C); http://cvs.php.net/diff.php/ZendEngine2/zend_objects.c?r1=1.41&r2=1.42&ty=u Index: ZendEngine2/zend_objects.c diff -u ZendEngine2/zend_objects.c:1.41 ZendEngine2/zend_objects.c:1.42 --- ZendEngine2/zend_objects.c:1.41 Mon Feb 2 07:28:19 2004 +++ ZendEngine2/zend_objects.c Tue Feb 3 07:36:13 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.41 2004/02/02 12:28:19 zeev Exp $ */ +/* $Id: zend_objects.c,v 1.42 2004/02/03 12:36:13 zeev Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -101,28 +101,19 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC) { + zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); if (old_object->ce->clone) { - zval *old_obj; zval *new_obj; zval *clone_func_name; zval *retval_ptr; HashTable symbol_table; zend_class_entry *ce = old_object->ce; - zval **args[1]; - - zend_hash_copy(new_object->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); MAKE_STD_ZVAL(new_obj); new_obj->type = IS_OBJECT; new_obj->value.obj = new_obj_val; zval_copy_ctor(new_obj); - MAKE_STD_ZVAL(old_obj); - old_obj->type = IS_OBJECT; - old_obj->value.obj.handle = handle; - old_obj->value.obj.handlers = &std_object_handlers; /* If we reached here than the handlers are standrd */ - zval_copy_ctor(old_obj); - /* FIXME: Optimize this so that we use the old_object->ce->clone function pointer instead of the name */ MAKE_STD_ZVAL(clone_func_name); clone_func_name->type = IS_STRING; @@ -130,11 +121,8 @@ clone_func_name->value.str.len = sizeof("__clone")-1; ZEND_INIT_SYMTABLE(&symbol_table); - args[0] = &old_obj; - call_user_function_ex(NULL, &new_obj, clone_func_name, &retval_ptr, 1, args, 1, &symbol_table TSRMLS_CC); - - zval_ptr_dtor(args[0]); + call_user_function_ex(NULL, &new_obj, clone_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC); zend_hash_destroy(&symbol_table); zval_ptr_dtor(&new_obj); @@ -142,8 +130,6 @@ if(retval_ptr) { zval_ptr_dtor(&retval_ptr); } - } else { - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); } }

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