Re: Output in destructor

From: Date: Thu, 03 Jan 2002 08:48:04 +0000
Subject: Re: Output in destructor
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-3756@lists.php.net to get a copy of this message
On Thu, 03 Jan 2002 00:46:52 +0100, Stig S. Bakken wrote: >Martin Jansen wrote: >> >> Hi, >> >> from the manual: >> >> "Note: PEAR "destructors" use PHP's shutdown callbacks >> (register_shutdown_function()), and you can't output anything from these when >> PHP is running in a web server. So anything printed in a "destructor" gets lost >> except when PHP is used in command-line mode. Bummer." >> >> I think this is not right anymore, since the following script outputs >> 'destructor' in PHP 4.2.0-dev as Apache module: >> >> <?php >> require_once "PEAR.php"; >> >> class Test extends PEAR >> { >> function Test() >> { >> $this->PEAR(); >> } >> >> function _Test() >> { >> echo "destructor"; >> } >> } >> >> $obj =& new Test; >> ?> >> >> I can't test right now if this is also happening in 4.1.0. Can anyone >> else with a running version of 4.1 do this? >> >> If it is also possible to generate output in 4.1, I will remove >> the passage from the manual. > >Don't remove it, say that it doesn't work until version 4.1.0. :-) I changed the manual to: "Note: PEAR "destructors" use PHP's shutdown callbacks (register_shutdown_function()), and in PHP < 4.1, you can't output anything from these when PHP is running in a web server. So anything printed in a "destructor" gets lost except when PHP is used in command-line mode. In PHP 4.1 and higher, output can be also generated in the destructor. " - Martin -- Martin Jansen, <mail@martin-jansen.de> http://www.martin-jansen.de/

« previous php.pear.dev (#3756) next »