Re: Storing zvals in hash tables in resources
| From: | Martin Jansen | Date: | Sat, 23 Oct 2010 06:29:14 +0000 |
| Subject: | Re: Storing zvals in hash tables in resources | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49960@lists.php.net to get a copy of this message | ||
On 23.10.10 01:05, Gustavo Lopes wrote:
> On Fri, 22 Oct 2010 22:22:06 +0100, Martin Jansen <martin@divbyzero.net>
> 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