|  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
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
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.3 OS: *
Private report: No CVE-ID:
 [2004-06-19 02:22 UTC] rodolfo at rodsoft dot org
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;


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


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]
Please try using this CVS snapshot:
For Windows:

 [2005-03-06 22:42 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 08:01:52 2015 UTC