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

From: Date: Thu, 19 Jul 2001 12:26:49 +0000
Subject: RE: [PHP-DEV] Zend engine: unresolved external _zend_assign_to_va riable_reference?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60286@lists.php.net to get a copy of this message
At 15:36 19/07/2001, Marc Boeren wrote:
(*actual_ptr)->refcount++; (*actual_ptr)->is_ref =1;
(a) You only have to set is_ref once. I only set it once... or is increasing the refcount enough?
No, if you just increase refcount and is_ref is not set, the values will not be referenced to each other (i.e., changing one won't change the other).
(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. What I meant was, without setting _either_ refcount or is_ref (so only the hash_update call), it still works with no mem loss.
It's not supposed to work, you may be lucky, but chances are it'd crash.
So, do I need just the refcount++, or the is_ref=1 as well?
If you want the values to be connected to each other (changing one will change the other), you need to set is_ref to 1. Otherwise, you don't. In any case, you must update the refcount. Zeev

« previous php.dev (#60286) next »