Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49960 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96388 invoked from network); 23 Oct 2010 06:29:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2010 06:29:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=martin@divbyzero.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=martin@divbyzero.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain divbyzero.net from 87.230.111.147 cause and error) X-PHP-List-Original-Sender: martin@divbyzero.net X-Host-Fingerprint: 87.230.111.147 mx.bauer-kirch.de Linux 2.6 Received: from [87.230.111.147] ([87.230.111.147:50584] helo=mx.bauer-kirch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/84-04650-FB082CC4 for ; Sat, 23 Oct 2010 02:29:20 -0400 Received: by mx.bauer-kirch.de with ESMTP id 1P9XbQ-0004Ge-Lx; Sat, 23 Oct 2010 08:29:16 +0200 Message-ID: <4CC280BA.4070100@divbyzero.net> Date: Sat, 23 Oct 2010 08:29:14 +0200 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Gustavo Lopes CC: internals@lists.php.net References: <4CC2007E.2070703@divbyzero.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Storing zvals in hash tables in resources From: martin@divbyzero.net (Martin Jansen) On 23.10.10 01:05, Gustavo Lopes wrote: > On Fri, 22 Oct 2010 22:22:06 +0100, Martin Jansen > wrote: > >> I'm trying to store zvals in a hash table which is part of a resource. >> Unfortunately the zvals do not seem to "persist" between function calls: > > You probably want to give a destructor to zend_hash_init, since you're > storing zvals, that would be ZVAL_PTR_DTOR. > > You're not incrementing the refcount of the value you're adding to the > hash table. Call zval_add_ref. Those two hints seem to do the trick. Thanks! - Martin