Output in destructor
| From: | Martin Jansen | Date: | Sat, 15 Dec 2001 17:08:00 +0000 |
| Subject: | Output in destructor | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3489@lists.php.net to get a copy of this message | ||
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.
- Martin
--
Martin Jansen, <mail@martin-jansen.de>
http://www.martin-jansen.de/