#33290 [Opn->Bgs]: __destruct and shutdown functions are not called
| From: | helly@php.net | Date: | Thu, 09 Jun 2005 21:54:41 +0000 |
| Subject: | #33290 [Opn->Bgs]: __destruct and shutdown functions are not called | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80112@lists.php.net to get a copy of this message | ||
ID: 33290
Updated by: helly@php.net
Reported By: gasper dot kozak at tobonet dot com
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
-Operating System: Linux 2.6.10-gentoo-r2+Apache2
+Operating System: *
-PHP Version: 5.0.4
+PHP Version: 5.*
New Comment:
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
It is being called, RTFM.
Previous Comments:
------------------------------------------------------------------------
[2005-06-09 23:36:02] gasper dot kozak at tobonet dot com
Description:
------------
The __destruct method of a simple class (not inherited) is not called,
same goes for shutdown function.
URL of the problem: http://www.kje.si/iass/lib/App/test_destruct.php
Works with PHP 5.0.3 + Apache2, running on 2.6.11-gentoo, which is my
other server.
URL of the working script:
http://dev.tobonet.com/kje.si/lib/App/test_destruct.php
The code below is the stored into a file, nothing else is there, no
other files included, nothing.
The configure command is copied from phpinfo:
'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--with-apxs2=/usr/sbin/apxs2'
'--with-config-file-path=/etc/php/apache2-php5' '--without-pear'
'--disable-bcmath' '--with-bz2' '--disable-calendar'
'--with-cpdflib'
'--disable-ctype' '--with-curl' '--with-curlwrappers'
'--disable-dbase'
'--enable-dio' '--disable-exif' '--without-fam'
'--without-fbsql'
'--without-fdftk' '--disable-filepro' '--enable-ftp'
'--with-gettext'
'--without-gmp' '--without-hwapi' '--without-iconv'
'--without-informix' '--without-ingres' '--without-interbase'
'--without-kerberos' '--enable-mbstring' '--with-mcrypt'
'--without-mcve' '--disable-memory-limit' '--without-mhash'
'--without-mime-magic' '--without-ming' '--without-mnogosearch'
'--without-msql' '--without-mssql' '--with-ncurses'
'--without-oci8'
'--without-oracle' '--with-openssl' '--with-openssl-dir=/usr'
'--without-ovrimos' '--disable-pcntl' '--without-pcre-regx'
'--without-pfpro' '--with-pgsql' '--with-pspell'
'--without-recode'
'--enable-shmop' '--without-snmp' '--enable-soap'
'--enable-sockets'
'--without-sybase' '--without-sybase-ct' '--enable-sysvmsg'
'--enable-sysvsem' '--enable-sysvshm' '--with-tidy'
'--disable-wddx'
'--without-xsl' '--without-xmlrpc' '--disable-yp'
'--with-zlib'
'--disable-debug' '--without-cdb' '--with-db4'
'--without-dbm'
'--with-flatfile' '--with-gdbm' '--with-inifile'
'--without-qdbm'
'--with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--with-t1lib=/usr'
'--with-ttf=/usr' '--enable-gd-jis-conf' '--enable-gd-native-ttf'
'--with-png-dir=/usr' '--with-tiff-dir=/usr' '--without-xpm-dir'
'--with-gd' '--with-imap' '--with-imap-ssl' '--with-ldap'
'--without-ldap-sasl' '--with-unixODBC' '--without-adabas'
'--without-birdstep' '--without-dbmaker' '--without-empress'
'--without-esoob' '--without-ibm-db2' '--without-iodbc'
'--without-sapdb' '--without-solid' '--with-mysqli'
'--with-mm'
'--without-msession' '--without-sqlite' '--enable-dba'
'--with-readline' '--without-libedit' '--enable-versioning'
Reproduce code:
---------------
<?php
// set error displaying to full
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
function OnShutdown()
{
echo "OnShutdown function called.\n";
}
// register this function to be run at script shutdown
register_shutdown_function('OnShutdown');
// define a class with a destructor
// taken from php.net example for __destruct
class MyDestructableClass
{
function __construct()
{
print "In constructor\n";
$this->name = "MyDestructableClass";
}
function __destruct()
{
print "Destroying " . $this->name . "\n";
}
}
// create a class
$obj = new MyDestructableClass();
?>
Expected result:
----------------
Text output:
In constructor
OnShutdown function called.
Destroying MyDestructableClass
Actual result:
--------------
Text output:
In constructor
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33290&edit=1