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

From: Date: Mon, 31 Dec 2012 10:22:32 +0000
Subject: Re: Can't get zval write property handler working for ++/--/[]++ and other operators
References: 1 2 3 4 5  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-10132@lists.php.net to get a copy of this message
On 12/31/2012 02:37 PM, Ruslan Osmanov wrote:
On 12/31/2012 02:02 PM, Julien SALLEYRON wrote:
Hi, As you can see here http://lxr.php.net/xref/PHP_5_4/Zend/zend_vm_execute.h#25778 When you inc or dec, php try to get the ptr_ptr and then increment/decrement directly without any call to zend_std_read_property or zend_std_write_property. In AOP, I have done like that https://github.com/AOP-PHP/AOP/blob/master/aop.c#L287 (I'm not sure this is the right/best solution but it works for me) I have overloaded the get_property_ptr_ptr : If the current opcode is inc or dec, then I return null in order to continue ( http://lxr.php.net/xref/PHP_5_4/Zend/zend_vm_execute.h#25792) and call the original read and write handler
Hi, thanks. Tried your approach. Unfortunately, doesn't work for me: (--$w->data['i'] <= 0) and $w->stop(); results `PHP Notice: Undefined index: i'. I'm afraid, I have to implement get_property_ptr_ptr handlers for each zval property.
This ugly thing works: https://bitbucket.org/osmanov/pecl-ev/downloads/prop_ptr_ptr.patch I'll point to the source: 1) Special handler for a property :/ https://bitbucket.org/osmanov/pecl-ev/src/0e0240d22b8fccd8dc6479978fd0de9f1783d0d6/pe.c?at=develop#cl-208 2) Binding: https://bitbucket.org/osmanov/pecl-ev/src/0e0240d22b8fccd8dc6479978fd0de9f1783d0d6/ev.c?at=develop#cl-180 3) Data types: https://bitbucket.org/osmanov/pecl-ev/src/0e0240d22b8fccd8dc6479978fd0de9f1783d0d6/types.h?at=develop Well, it works, at least. I wish somebody give me a tip how to do it nicer. -- Regards, Ruslan Osmanov http://osmanov-dev-notes.blogspot.com | @ruslan_osmanov

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