Edit report at http://bugs.php.net/bug.php?id=53483&edit=1
ID: 53483 Updated by: u...@php.net Reported by: squarious at gmail dot com Summary: using mysqli_stmt::send_long_data() makes execute() fail -Status: Open +Status: Assigned Type: Bug Package: MySQLi related Operating System: linux PHP Version: 5.3.3 -Assigned To: +Assigned To: mysql Block user comment: N Private report: N New Comment: Andrey, smells like a server bug fixed in the latest 5.0, 5.1. 5.5 series. Below is mysqlnd @ 64bit @ MySQL 5.1.45. Ulf nixn...@linux-fuxh:~/php/php-src/branches/PHP_5_3_cta> sapi/cli/php foo.php array(1) { ["client_info"]=> string(48) "mysqlnd 5.0.7-dev - 091210 - $Revision: 306939 $" } array(1) { ["server_info"]=> string(12) "5.1.45-debug" } OK: Executed prepared statement with blob less than max_allowed_packet. Error executing prepared statement. Got a packet bigger than 'max_allowed_packet' bytes Previous Comments: ------------------------------------------------------------------------ [2011-01-06 14:20:01] u...@php.net Please always add complete test. Never link external sites. <?php // Reproduce bug that with send_long_data, execute() fails // Agjust your settings before execute $conn = new mysqli( 'localhost', // << Server 'root', // << Username 'root', // << Password 'test' // << Schema ); if (!$conn->query('CREATE TABLE IF NOT EXISTS `test_bug_blob` (`id` integer auto_increment, `data` BLOB, PRIMARY KEY(`id`));')) die("Error creating table.\n"); if (!($result = $conn->query('SELECT @@max_allowed_packet'))) die("Error reading max allowed packet size.\n"); $max_allowed_packet = $result->fetch_array(); $max_allowed_packet = $max_allowed_packet[0]; if (!($stmt = $conn->prepare('INSERT INTO `test_bug_blob` (`data`) VALUES (?)'))) die("Cannot prepare statement for INSERT. {$conn->error}\n"); // Sent blob smaller than max allowed_packet $data = str_repeat('0123456789', $max_allowed_packet/20); if (!$stmt->bind_param('s', $data)) die("Error binding parameters. {$stmt->error}\n"); if (!$stmt->execute()) die("Error executing prepared statement. {$stmt->error}\n"); echo "OK: Executed prepared statement with blob less than max_allowed_packet.\n"; // Sent blob bigger than max allowed_packet $big_data = str_repeat('0123456789', $max_allowed_packet/9); $null = null; if (!$stmt->bind_param('b', $null)) die("Error binding parameters. {$stmt->error}\n"); foreach(str_split($big_data, $max_allowed_packet) as $packet ) if (!$stmt->send_long_data(0, $packet)) die("Error sending long packet. {$stmt->error}\n"); if (!$stmt->execute()) die("Error executing prepared statement. {$stmt->error}\n"); echo "OK: Executed prepared statement with blob bigger than max_allowed_packet, sent at chunks.\n"; ------------------------------------------------------------------------ [2010-12-20 17:56:32] jbreton at kronostechnologies dot com I upgraded mysql to 5.1.54 using debian experimental packages and the problem is gone. Hopefully it won't break my ubuntu setup, which was a brand new 10.10 using official packages. ------------------------------------------------------------------------ [2010-12-20 17:14:09] jbreton at kronostechnologes dot com You haven't tried mysql5.1.49 which was specified in squarious' description. I just tried with php 5.3.4 stable and mysql5.1.49 without success. ------------------------------------------------------------------------ [2010-12-20 17:14:07] jbreton at kronostechnologes dot com You haven't tried mysql5.1.49 which was specified in squarious' description. I just tried with php 5.3.4 stable and mysql5.1.49 without success. ------------------------------------------------------------------------ [2010-12-20 16:51:45] and...@php.net I can't reproduce the problem :( ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=53483 -- Edit this bug report at http://bugs.php.net/bug.php?id=53483&edit=1