Re: Delayed exception
| From: | Piotr Pokora | Date: | Mon, 25 Feb 2008 08:32:52 +0000 |
| Subject: | Re: Delayed exception | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5142@lists.php.net to get a copy of this message | ||
Pierre Joye pisze:
> > Hi Piotr,
Hi!
>> >> Can anyone explain me why exception is thrown in such undefined
order?
>> >>
>> >> I did such workaround in extension:
>> >>
>> >> g_signal_emit(GObject, signal_id);
>> >> if(EG(exception))
>> >> zend_exception_error(EG(exception) TSRMLS_CC);
>> >> bar();
>> >>
>> >> Should I always throw exception explicitly from extension's level?
> >
> >
> > Are you sure that it is not the buffering and/or which of stdout or
> > stderr outputs the exception message?
OB is off. This is simple cli script, so everything goes to stderr.
But there is another issue with zend_exception_error. It's not
catchable. I checked ZE2 sources and error is triggered if exception is
not an instance of EG(exception). I added debug messages and exception
thrown is Exception instance, and the same is thrown in php code.
I also tested code with valgrind and it shows no memory corruption or leaks.
Maybe I should try similiar code with php-gtk2 which uses the same
signals' emission feature?
Piotras