php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28840 __destruct of a class that extends mysqli not called
Submitted: 2004-06-19 02:22 UTC Modified: 2005-03-06 22:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rodolfo at rodsoft dot org Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.3 OS: *
Private report: No CVE-ID: None
 [2004-06-19 02:22 UTC] rodolfo at rodsoft dot org
Description:
------------
When you create a class by extending mysqli or mysqli_result and add a destructor to it (to automatically call mysqli::close, for instance), it doesn't get called when the object gets out of scope.

Reproduce code:
---------------
<?

class test extends mysqli
{
    function __construct() { echo "born\n"; }
    function __destruct() { echo "died\n"; }
}

$test = new test;
unset($test);

?>


Expected result:
----------------
born
died

Actual result:
--------------
born

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-01 23:54 UTC] tfraser at jeffsys dot net
As of 5.0.2, the same problem occurs.
 [2005-02-13 10:15 UTC] ryan at wonko dot com
I'm experiencing this problem with a class that extends DOMDocument using PHP 5.0.3 under both Windows XP and FreeBSD 5.3.
 [2005-03-06 20:30 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-06 22:42 UTC] helly@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC