|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34450 Segfault when calling close() in destructor.
Submitted: 2005-09-10 03:46 UTC Modified: 2005-09-13 11:20 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: etnu at etnu dot org Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5CVS-2005-09-10 (snap) OS: *
Private report: No CVE-ID: None
 [2005-09-10 03:46 UTC] etnu at etnu dot org
I'm getting a seg fault when calling mysqli::close() from a derived object in the destructor.

This happens in PHP 5.0.5 (stable), 5.1.0RC1, and all latest snaps, but it does NOT happen in 5.0.4.

Current workaround:

Leave connections open; dunno if this is a major issue or not as connections are supposed to get closed when the script terminates anyway.

Reproduce code:
class Data extends mysqli
        public function __construct($Host,$User,$Pass,$DB)
        public function __destruct()
                // parent::close(); causes the segfault as well.

$DB = new Data('','web','f@m!l!es','hermes');


Expected result:
Not seg faulting.

Actual result:
Segmentation faults.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-13 09:55 UTC] hans dot duedal at gmail dot com
Happens on FreeBSD 5.4 (x86_64) as well...

Does mysqli::__destruct close the connection?
 [2005-09-13 11:20 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-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 14:01:29 2023 UTC