ID: 46448 Updated by: [EMAIL PROTECTED] Reported By: pcdinh at gmail dot com -Status: Open +Status: Assigned Bug Type: MySQLi related Operating System: Windows XP SP3 PHP Version: 5.2.7RC2 -Assigned To: +Assigned To: mysql
Previous Comments: ------------------------------------------------------------------------ [2008-11-01 09:41:34] pcdinh at gmail dot com Description: ------------ Make a multiple queries that contains a buggy DML SQL command with mysqli_multi_query can cause MySQL connection closed: mysqli_ping returns false right after mysqli_multi_query() invocation. Apache 2.2.6 MySQL 5.0.67 Reproduce code: --------------- <?php ini_set('mysqli.reconnect', 'Off'); $mysqli = mysqli_init(); mysqli_real_connect($mysqli, "localhost", "root", "123456", "test"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* CREATE TABLE `test2` ( `id` int(11) DEFAULT NULL, `username` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Buggy DML SQL command: INSERT INTO test2 VALUES (1008-, 'pcdinh5') */ $query = "INSERT INTO test2 VALUES (1007, 'pcdinh4');INSERT INTO test2 VALUES (1008-, 'pcdinh5');"; /* execute multi query */ mysqli_multi_query($mysqli, $query); if (false === mysqli_ping($mysqli)) { exit('Database connection is closed'); } ?> Expected result: ---------------- Nothing happens. If this script produces a message: Database connection is closed means there is a problem Actual result: -------------- This script produces a message: Database connection is closed ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46448&edit=1