ID: 39457 Updated by: [EMAIL PROTECTED] 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:
This is actually a MySQL C API problem, too. mysql_real_connect() (the C API function that mysqli::real_connect() is built upon) does allow a 2nd connect on an already connected MYSQL structure, too, and the result is that a 2nd connection to the server is opened and the previous connection enters a "zombie" state ... Now filed as MySQL bug: http://bugs.mysql.com/33831 Previous Comments: ------------------------------------------------------------------------ [2007-10-23 08:29:51] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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] [EMAIL PROTECTED] 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