Re: Fwd: How to create Persistent zval?

From: Date: Mon, 20 Jan 2014 16:23:33 +0000
Subject: Re: Fwd: How to create Persistent zval?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-71326@lists.php.net to get a copy of this message
Hi,

On Sun, 2014-01-19 at 02:47 +0800, Lin Yo-An wrote:
> Is there a way to keep a zval persistent in the persistent_list? Or
> how do
> I deeply clone an object in extension and make it persistent? 

What is it that *actually* want to achieve?

If you want to keep the state of objects for some time then you an store
that in persistent allocated memory buffers and extend zend_object with
a pointer
   struct my_object { zend_object inner; custom_data *ptr };
and then use the property hooks to "emulate" properties and accessor
methods as your API should look like.
Your MSHUTDOWN then has to handle the final cleanup of the data.

Mind that for many deployment models of PHP request-surviving objects
(like ASP's Application object) aren't a good architectural choice as
PHP can live in CGI context (where there are no recurring requests), in
FastCGI context (where there are recurring requests to multiple parallel
processes), in IIS/apachempm/etc context (where there are multiple
threads doing this in parallel) and multi machine context where
recurring requests may hit different machines ... having a cheaply
serializable format often is better.

johannes




Thread (14 messages)

« previous php.internals (#71326) next »