Re: Delayed exception - SOLVED
| From: | Piotr Pokora | Date: | Thu, 13 Mar 2008 18:36:35 +0000 |
| Subject: | Re: Delayed exception - SOLVED | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5169@lists.php.net to get a copy of this message | ||
Piotr Pokora writes:
I think I found the source of the problem here.
It's PHPG_THROW_EXCEPTION macroo.
> try{
> new WindowTest();
> } catch(Exception $e) {
> echo $e->getMessage();
> }
>
> Output is:
>
> Fatal error: Uncaught exception 'Exception' with message 'DADA'
>
> I throw Exception and catch Exception. Why this error?
Exception is "Uncaught" because it's not explicitly returned by function.
The line which throws it is:
zend_throw_exception(exception, message, 0 TSRMLS_CC);
While it should looks like this:
return_value = zend_throw_exception(exception, message, 0 TSRMLS_CC);
I am not sure if it's misfeature but at least such pattern makes
exceptions *working* with signal emissions.
Though... I wonder when I look at PHP5 standard extensions' code.
There are plenty of zend_throw_exception invocations without any
returned value being set.
Is this desired API behaviour?
Piotras