Re: Can't get zval write property handler working for ++/--/[]++ and other operators

From: Date: Mon, 31 Dec 2012 05:44:45 +0000
Subject: Re: Can't get zval write property handler working for ++/--/[]++ and other operators
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-10129@lists.php.net to get a copy of this message
On 12/30/2012 06:36 PM, Michael Wallner wrote:
On 30 December 2012 08:05, Ruslan Osmanov<rrosmanov@gmail.com> wrote:
Hi. [...] both don't modify the property either. I suspect I should whether return a reference in the read-handler, or implement some kind of handler, maybe get_property_ptr_pt(but how?)
Exactly, there's a get_property_ptr handler. Just look at other php/pecl extensions implementing this handler.
Thanks a lot for your reply. I doubt. Most get_property_ptr_ptr handlers look like this function: https://github.com/php/php-src/blob/master/ext/dom/php_dom.c#L306 But I wonder what this line actually does: ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd); because the found hnd is not used until the end of the function. Thus, we don't get the desirec pointer to pointer. The only extension I found returning the found retval is spl. It returns value found by zend_symtable_find. Spl's code is pretty complicated. I guess, in case the property found, I should call read_func, then modify some of zval properties, e.g. make it a reference and increment refcount. I didn't found an extension that does this. That's why I'm in doubt. -- Regards, Ruslan Osmanov http://osmanov-dev-notes.blogspot.com | @ruslan_osmanov

« previous php.pecl.dev (#10129) next »