osdir.com
mailing list archive

Subject: Re: Delayed exception - msg#00045

List: php.pecl.devel

Date: Prev Next Index Thread: Prev Next Index
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



Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: Lack of karma

Pierre, Thanks! It does indeed work. Thanks again, - p On Feb 24, 2008, at 7:10 PM, Pierre Joye wrote: On Mon, Feb 25, 2008 at 2:38 AM, Paul Chandler <mailslot@xxxxxxx> wrote: Rasmus, Weird, this was the response I received on 1/29 (pasted): Your CVS account (pestilence669) was created. It should work well now. Your cvs account was actually created and I gave you the correct karma a couple of mins before. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Next Message by Date: click to view message preview

Re: Delayed exception

Piotr Pokora pisze: > Maybe I should try similiar code with php-gtk2 which uses the same > signals' emission feature? I tested it with gtkwindow.php available in demos: Add simple test_cb class. class test_cb { function test_cba() { throw new Exception("DADA"); } } Connect to destroy signal in constructor: $this->connect_simple('destroy', array('test_cb', 'test_cba')); And try/catch : 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? Piotras

Previous Message by Thread: click to view message preview

Re: Delayed exception

Hi Piotr, On Sun, Feb 24, 2008 at 10:49 AM, Piotr Pokora <piotrek.pokora@xxxxxxxxx> wrote: > Hi! > > Here's pseudo code (C) in php extension: > > foo() > { > g_signal_emit(GObject, signal_id); > bar(); > } > > And PHP pseudo code : > > function my_callback($obj) > { > throw new Exception("DADA"); > echo "A"; > } > > $obj->connect(signal_id, m_callback); > $obj->foo(); > > Method foo is executed. > 'A' is echoed. > bar() is executed; > Exception with 'DADA' message is thrown. > > 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? -- Pierre http://blog.thepimp.net | http://www.libgd.org

Next Message by Thread: click to view message preview

Re: Delayed exception

Piotr Pokora pisze: > Maybe I should try similiar code with php-gtk2 which uses the same > signals' emission feature? I tested it with gtkwindow.php available in demos: Add simple test_cb class. class test_cb { function test_cba() { throw new Exception("DADA"); } } Connect to destroy signal in constructor: $this->connect_simple('destroy', array('test_cb', 'test_cba')); And try/catch : 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? Piotras
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by