Re: Fwd: How to create Persistent zval?

From: Date: Sat, 18 Jan 2014 18:55:53 +0000
Subject: Re: Fwd: How to create Persistent zval?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-71248@lists.php.net to get a copy of this message
On Sat, Jan 18, 2014 at 7:47 PM, Lin Yo-An <cornelius.howl@gmail.com> wrote: > Hello, > > I am trying to store a zval object into the persistent list in zend VM. > (Using EG(persistent_list) and zend_rscd_list_entry) > > Which works fine if I store/fetch the zval in the same request context. > > But it seems that zend engine cleans up the zval object after the request, > when the next request comes, the fetched list entry points to a freed zval > address and it makes php segmentationfault. I guess zval is allocated by > emalloc, so I cant keep it cross requests? For persistent alloc, you should use pemalloc() , which is just a wrapper leading to libc's malloc. If you use emalloc() , the Zend Memory Manager will free the storage at the end of the request, thus leading to use-after-free crash if you reuse your pointer on a next request. Julien

« previous php.internals (#71248) next »