From:             gasper dot kozak at tobonet dot com
Operating system: Linux 2.6.10-gentoo-r2+Apache2
PHP version:      5.0.4
PHP Bug Type:     Zend Engine 2 problem
Bug description:  __destruct and shutdown functions are not called

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 bug report at http://bugs.php.net/?id=33290&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33290&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33290&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33290&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33290&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33290&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33290&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33290&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33290&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33290&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33290&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33290&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33290&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33290&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33290&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33290&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33290&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33290&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33290&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33290&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33290&r=mysqlcfg

Reply via email to