RE: [PHP-DEV] Zend engine: unresolved external _zend_assign_to_va riable_referen ce?

From: Date: Thu, 19 Jul 2001 12:07:16 +0000
Subject: RE: [PHP-DEV] Zend engine: unresolved external _zend_assign_to_va riable_referen ce?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60284@lists.php.net to get a copy of this message
At 14:36 19/07/2001, Marc Boeren wrote:
When you build the result hash, use the same zval * in both places (don't forget the right refcount), it should work. Yes, just use the same zval *, increase refcount accordingly, and set the is_ref bit. It'd be much faster (and also more correct) than using the assign_to_variable_reference() function... OK, could you help me out here? Can I just do this: zend_hash_index_find((*row_ptr)->value.ht, col_index, (void **) &actual_ptr); (*actual_ptr)->refcount++; (*actual_ptr)->is_ref =1; zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val, (*columnname_ptr)->value.str.len + 1, actual_ptr, sizeof(zval *), NULL); This seems to work. However, I tried it without the refcount and is_ref statements, and it still seems to work... (this is in the 4.0.6 version, btw) There is no memory loss for both versions...
(a) You only have to set is_ref once. (b) If you don't increase the refcount, the behavior is undefined, and is likely to end up crashing PHP. Not increasing refcount may actually give you the same behavior as setting is_ref to 1, but it would crash, sooner or later. Zeev

« previous php.dev (#60284) next »