Index: Zend/zend.h =================================================================== RCS file: /repository/ZendEngine2/zend.h,v retrieving revision 1.293.2.11.2.3 diff -u -p -d -r1.293.2.11.2.3 zend.h --- Zend/zend.h 19 May 2006 06:09:14 -0000 1.293.2.11.2.3 +++ Zend/zend.h 6 Jun 2006 17:49:26 -0000 @@ -365,6 +365,7 @@ struct _zend_class_entry { zend_uint doc_comment_len; struct _zend_module_entry *module; + zend_bool inherited; }; #include "zend_stream.h" Index: Zend/zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.647.2.27.2.11 diff -u -p -d -r1.647.2.27.2.11 zend_compile.c --- Zend/zend_compile.c 6 Jun 2006 14:17:21 -0000 1.647.2.27.2.11 +++ Zend/zend_compile.c 6 Jun 2006 17:49:27 -0000 @@ -2182,6 +2182,7 @@ ZEND_API void zend_do_inherit_interfaces /* and now call the implementing handlers */ while (ce_num < ce->num_interfaces) { + ce->interfaces[ce_num]->inherited = 1; do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC); } } @@ -2247,6 +2248,20 @@ static zend_bool do_inherit_constant_che ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) { + zend_uint i, if_num = ce->num_interfaces, cnt = 0; + + for (i = 0; i < if_num; i++) { + if (ce->interfaces[i] != NULL && ce->interfaces[i]->name_length == iface->name_length && !memcmp(ce->interfaces[i]->name, iface->name, iface->name_length)) { + cnt++; + if (cnt > 1 && ce->interfaces[i]->inherited != 0) { + /* the interface was previously inherited, ignoring */ + return; + } else if (cnt > 1) { + zend_error(E_COMPILE_ERROR, "Cannot implement previously implemented interface %s", iface->name); + } + } + } + zend_hash_merge_ex(&ce->constants_table, &iface->constants_table, (copy_ctor_func_t) zval_add_ref, sizeof(zval *), (merge_checker_func_t) do_inherit_constant_check, iface); zend_hash_merge_ex(&ce->function_table, &iface->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce); @@ -4070,6 +4085,7 @@ ZEND_API void zend_initialize_class_data ce->doc_comment = NULL; ce->doc_comment_len = 0; + ce->inherited = 0; zend_hash_init_ex(&ce->default_properties, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0); zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);