cvs: ZendEngine2 / zend_compile.c

From: Date: Sun, 10 Nov 2002 22:02:28 +0000
Subject: cvs: ZendEngine2 / zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-596@lists.php.net to get a copy of this message
andi Sun Nov 10 17:02:28 2002 EDT Modified files: /ZendEngine2 zend_compile.c Log: - MFZE1 Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.322 ZendEngine2/zend_compile.c:1.323 --- ZendEngine2/zend_compile.c:1.322 Sun Nov 10 12:50:27 2002 +++ ZendEngine2/zend_compile.c Sun Nov 10 17:02:28 2002 @@ -930,8 +930,18 @@ short_class_name_length = strlen(short_class_name); } } - - zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); + if (zend_hash_add(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { + zend_op_array *child_op_array, *parent_op_array; + if (CG(active_class_entry)->parent + && (zend_hash_find(&CG(active_class_entry)->function_table, name, name_len+1, (void **) &child_op_array) == SUCCESS) + && (zend_hash_find(&CG(active_class_entry)->parent->function_table, name, name_len+1, (void **) &parent_op_array) == SUCCESS) + && (child_op_array == parent_op_array)) { + zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); + } else { + zend_error(E_COMPILE_ERROR, "Cannot redeclare %s()", name); + } + } + if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))) { CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {

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