wez Mon Feb 10 07:36:06 2003 EDT Modified files: /php4/ext/rpc rpc.c Log: Newly created objects should use a separate function_table from the global class entry table. For objects instantiated via new, make sure that intern->function_table uses the newly created table when the class is registered. For generic per-object hashing, copy the ce->function_table into intern->function_table. Index: php4/ext/rpc/rpc.c diff -u php4/ext/rpc/rpc.c:1.20 php4/ext/rpc/rpc.c:1.21 --- php4/ext/rpc/rpc.c:1.20 Sun Feb 9 18:17:41 2003 +++ php4/ext/rpc/rpc.c Mon Feb 10 07:36:06 2003 @@ -369,7 +369,7 @@ unsigned char *ref_types = NULL; GET_INTERNAL(intern); - if (zend_ts_hash_find(&(intern->function_table), method, method_len + 1, &function) != SUCCESS) { + if (zend_ts_hash_find(&intern->function_table, method, method_len + 1, +&function) != SUCCESS) { zend_internal_function *zif; /* get reftypes */ @@ -391,7 +391,7 @@ zif->type = ZEND_INTERNAL_FUNCTION; /* add new method to the method table */ - zend_ts_hash_add(&(intern->function_table), method, method_len + 1, zif, sizeof(zend_function), &function); + zend_ts_hash_add(&intern->function_table, method, method_len + 1, zif, +sizeof(zend_function), &function); efree(zif); } @@ -518,6 +518,7 @@ overloaded_class_entry.name_length = class_val.len; class_hash->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); intern->ce = class_hash->ce; + intern->function_table.hash = +intern->ce->function_table; /* register with non-hashed key * also track all instaces in a llist for destruction later on, because there might be duplicate entries in @@ -545,6 +546,7 @@ /* overload class entry */ INIT_CLASS_ENTRY(overloaded_class_entry, class_val.str, NULL); intern->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); + intern->function_table.hash = +intern->ce->function_table; } } } else { @@ -568,6 +570,7 @@ INIT_CLASS_ENTRY(overloaded_class_entry, class_val.str, NULL); class_hash->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); intern->ce = class_hash->ce; + intern->function_table.hash = intern->ce->function_table; /* register int hashcode, we don't know more */ zend_ts_hash_index_update(&classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL); @@ -805,7 +808,7 @@ intern->ce = class_type; intern->data = NULL; - intern->function_table.hash = intern->ce->function_table; + intern->function_table.hash = intern->ce->function_table; intern->function_table.reader = 0; intern->function_table.mx_reader = tsrm_mutex_alloc(); intern->function_table.mx_writer = tsrm_mutex_alloc(); @@ -914,6 +917,11 @@ class_hash->singleton = FALSE; class_hash->poolable = FALSE; class_hash->data = NULL; + + /* Copy the function table hash for this object, so that it is +separated + * from the "global" table */ + zend_ts_hash_init(&intern->function_table, 0, NULL, NULL, TRUE); + zend_hash_copy(&intern->function_table.hash, &ce->function_table, +NULL, NULL, 0); } RPC_CLASS(intern) = class_hash;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php