>Hi Julien,

Hi and thank you for taking the time to help.

> Don't over write EG(execute_data), but use your own pointer when it is
needed. I think this will fix your problem.

The problem here is that I have came to the conclusion (wrong
conclusion ?) that I need to update the EG(current_execute_data) "as
if" the former called function had been processed, to actually skip
the function that was called in PHP.


Maybe some code will be more explicit...

<?php

myFunction(); //the function is expected to be called (and will)


$hook = function () {throw new Exception()};

aop_add_before('myFunction()', $hook); //now we ask the extension to
call hook() before myFunction()

myFunction();//Now myFunction should never be called, as the hook is
raising an exception


Extension-wise, the code is located here
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L390), where I test
if the hook raised an exception or not.

If it did not, I'm calling the function
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L392
<https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L391>) and it ends
up updating EG(current_execute_data) with
EG(current_execute_data)->prev_execute_data.

Now, when the hook is raising an exception, I'd like to just skip the
function call. If I just "return"
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L397
<https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L396>) it ends up in
an infinite loop. reason why I tried  EG (current_execute_data) =
EG(current_execute_data)->prev_execute_data;

But this solution ends up in memory headakes...



2013/7/31 Yasuo Ohgaki <yohg...@ohgaki.net>

> Hi Julien,
>
> On Wed, Jul 31, 2013 at 6:24 PM, Julien SALLEYRON <
> julien.salley...@gmail.com> wrote:
>
>> If I EG(execute_data) = EG(execute_data)->prev_execute_data, there is no
>> loop anymore, but I have freeing error
>>
>
> Don't over write EG(execute_data), but use your own pointer when it is
> needed.
> I think this will fix your problem.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>

Reply via email to