#34450 [Com]: Segfault when calling close() in destructor.

From: Date: Tue, 13 Sep 2005 07:55:44 +0000
Subject: #34450 [Com]: Segfault when calling close() in destructor.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84977@lists.php.net to get a copy of this message
ID: 34450 Comment by: hans dot duedal at gmail dot com Reported By: etnu at etnu dot org Status: Verified Bug Type: MySQLi related Operating System: * PHP Version: 5CVS-2005-09-10 (snap) New Comment: Happens on FreeBSD 5.4 (x86_64) as well... Does mysqli::__destruct close the connection? Previous Comments: ------------------------------------------------------------------------ [2005-09-10 03:46:58] etnu at etnu dot org Description: ------------ 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: --------------- <?php class Data extends mysqli { public function __construct($Host,$User,$Pass,$DB) { parent::__construct($Host,$User,$Pass,$DB); } public function __destruct() { // parent::close(); causes the segfault as well. $this->close(); } } $DB = new Data('192.168.50.3','web','f@m!l!es','hermes'); ?> Expected result: ---------------- Not seg faulting. Actual result: -------------- Segmentation faults. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34450&edit=1

« previous php.bugs (#84977) next »