#39457 [Asn]: Multiple invoked OO connections never close

From: Date: Tue, 23 Oct 2007 08:29:52 +0000
Subject: #39457 [Asn]: Multiple invoked OO connections never close
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118855@lists.php.net to get a copy of this message
ID: 39457 Updated by: scottmac@php.net Reported By: josh at mykoala dot com Status: Assigned Bug Type: MySQLi related Operating System: OS X 10.4.8 PHP Version: 5.2.0 Assigned To: georg New Comment: It looks like a partial fix was added 6th of September for mysqli_connect, nothing for real_connect because calling mysql_close() destroys the mysql struct allocated by mysqli_init() so any values you had set would be lost. This could potentially cause problems if say you disabled auto_commit or similar. Previous Comments: ------------------------------------------------------------------------ [2007-10-23 00:18:42] josh at mykoala dot com About to celebrate the two-year anniversary of this one, woo! =) ------------------------------------------------------------------------ [2007-06-28 20:14:39] sniper@php.net Georg, reassign to someone else if this is not for you. :) ------------------------------------------------------------------------ [2007-05-08 21:36:09] bugs dot php at david-salisbury dot co dot uk I've experienced this behaviour on the latest PHP5 CVS (built May 8 2007 22:31:22) running in Apache 2.0.59 as mod_php5. Further reproduce code if necessary: <?php $m = new mysqli(); $m->init(); $m->real_connect('localhost', 'root', 'pass', 'dbname'); $m->real_connect('localhost', 'root', 'pass', 'dbname'); $m->real_connect('localhost', 'root', 'pass', 'dbname'); ?> ------------------------------------------------------------------------ [2006-11-10 12:00:27] josh at mykoala dot com Description: ------------ After invoking multiple identical connect() calls to a MySQLi object (after mysqli_init), only one is closed via close() or script termination. Reproduce code: --------------- # only when invoked through apache $db = mysqli_init(); $db->connect(null, 'root'); $db->connect(null, 'root'); $db->close(); Expected result: ---------------- Just like when using procedural MySQLi functions (or via mysql_* funcs), multiple connect() calls will not result in rogue db connections. Actual result: -------------- Checking the MySQL process list after each execution shows a rogue connection, which goes on until you reach max connections. This only happens when using OO style. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39457&edit=1

« previous php.bugs (#118855) next »