ID: 29372 User updated by: mark at seventhcycle dot net Reported By: mark at seventhcycle dot net Status: Open Bug Type: Zend Engine 2 problem Operating System: Fedora Core 2 PHP Version: 5.0.0 New Comment:
Sorry, the proper code posted would be: function shut() { echo "shutting down"; } register_shutdown_function("shut"); This prints out properly in php4. Is it a bug in php4, or a change of functionality for php5? Previous Comments: ------------------------------------------------------------------------ [2004-07-25 20:58:20] mark at seventhcycle dot net Interestingly, this follows the same behavior as register_shutdown_function() does in php5, in that it can't send anything out to the browser. php4 can do this, though, and does properly print shutdown information. function shut() { echo "shutting down"; } ------------------------------------------------------------------------ [2004-07-25 08:29:31] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You cannot use print, echo and friends in destructors because they are executed after the output facility has been shutdown. Use unset($obj) at the end of your script to force termination prior to starting shutdown process. ------------------------------------------------------------------------ [2004-07-25 07:55:31] mark at seventhcycle dot net Description: ------------ The destructor for any classes I make isn't being called. Here is a diff of my php.ini to the distributed one. /usr/local/lib#> diff php.ini php.ini-dist 120c120 < zlib.output_compression = On --- > zlib.output_compression = Off 293c293 < log_errors = On --- > log_errors = Off 340c340 < error_log = syslog --- > ;error_log = syslog 373c373 < register_globals = On --- > register_globals = Off 952c952 < session.use_trans_sid = 1 --- > session.use_trans_sid = 0 The reproduced code run below is live here: http://seventhcycle.net/php/classtest.php A copy of my phpinfo can be found here: http://seventhcycle.net/php/phpinfo.php Reproduce code: --------------- <?php class MyDestructableClass { function __construct() { print "construct\n"; } function __destruct() { print "destruct"; } } $obj = new MyDestructableClass(); ?> Expected result: ---------------- construct destruct Actual result: -------------- construct ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29372&edit=1