Re: zval_copy_ctor

From: Date: Sat, 12 May 2001 10:28:01 +0000
Subject: Re: zval_copy_ctor
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-54996@lists.php.net to get a copy of this message
On 2001-05-12 10:12:14, "Andi Gutmans" <andi@zend.com> wrote: > The code is almost OK. The only problem is that the reference count and > is_ref from rfcbuf->headers are also copied to *headers. So what you should > be doing (if you only add it once to the return_value) is to do > INIT_PZVAL(headers) before the hash_update so that they are reset to > refcount=1 is_ref=0. Like this? zval * headers; MAKE_STD_ZVAL(headers); *headers = *rfcbuf->headers; INIT_PZVAL(headers); if (zval_copy_ctor(headers) == SUCCESS) { zend_hash_update(HASH_OF(return_value), "headers", sizeof("headers"), &headers, sizeof(headers) NULL); } > And by the way, zval_copy_ctor does recursive copy constructing so your > code is OK. Great; that's a relief :-) Thanks! --Wez.

« previous php.dev (#54996) next »