Re: Delayed exception

From: Date: Mon, 25 Feb 2008 00:57:09 +0000
Subject: Re: Delayed exception
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5134@lists.php.net to get a copy of this message
Hi Piotr, On Sun, Feb 24, 2008 at 10:49 AM, Piotr Pokora <piotrek.pokora@gmail.com> 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

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