--------------050708030401000300080005
Content-Type: text/plain; cht=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

I guess I found a bug at "zend_compile.c". IMHO when you want to create
an internal hashtable, that will be filled with internal zvals
(malloc'ed instead of emalloc'ed), you should pass the "internal zval
destructor" to the hashtable initialization function. Currently,
"zend_compile.c" uses the "default zval destructor" for internal and
standard zvals. It leads to some error messages (about efree'ing blocks
that weren't emalloc'ed) at the end of execution.
Am I right, I mean is this the correct behaviour of an internal
hashtable ? Anyway, the patch attached fixes it.

Best Regards,

Cristiano Duarte

--------------050708030401000300080005
Content-Type: text/plain;
name="ze2_internal_symtables.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ze2_internal_symtables.patch"

? php-src/ZendEngine1
Index: php-src/Zend/zend_compile.c
================================================== =================
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.491
diff -u -r1.491 zend_compile.c
--- php-src/Zend/zend_compile.c 7 Nov 2003 10:22:16 -0000 1.491
+++ php-src/Zend/zend_compile.c 10 Nov 2003 02:50:54 -0000
-3511,6 +3511,7
void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC)
{
zend_bool persistent_hashes = (ce->type == ZEND_INTERNAL_CLASS) ? 1 : 0;
+ dtor_func_t zval_dtor = ((persistent_hashes) ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR);

ce->refcount = 1;
ce->constants_updated = 0;
-3527,8 +3528,9
} else {
ALLOC_HASHTABLE(ce->static_members);
}
- zend_hash_init_ex(ce->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
- zend_hash_init_ex(&ce->constants_table, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0);
+
+ zend_hash_init_ex(ce->static_members, 0, NULL, zval_dtor, persistent_hashes, 0);
+ zend_hash_init_ex(&ce->constants_table, 0, NULL, zval_dtor, persistent_hashes, 0);
zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);

if (nullify_handlers) {


--------------050708030401000300080005
Content-Type: text/plain; cht=us-ascii

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: [url]http://www.php.net/unsub.php[/url]
--------------050708030401000300080005--