#29372 [Opn->Csd]: destructor not called
| From: | helly@php.net | Date: | Sun, 25 Jul 2004 19:08:24 +0000 |
| Subject: | #29372 [Opn->Csd]: destructor not called | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63506@lists.php.net to get a copy of this message | ||
ID: 29372
Updated by: helly@php.net
Reported By: mark at seventhcycle dot net
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
-Operating System: Fedora Core 2
+Operating System: *
PHP Version: 5.0.0
-Assigned To:
+Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Whatever...this is fixed in cvs for 5.0.1
Previous Comments:
------------------------------------------------------------------------
[2004-07-25 21:00:39] mark at seventhcycle dot net
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?
------------------------------------------------------------------------
[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] helly@php.net
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