From: f dot engelhardt at 21torr dot com
Operating system: Linux 2.6
PHP version: 5.0.5
PHP Bug Type: MySQLi related
Bug description: prepared statement with blob field does not work
Description:
------------
Inserting a data into a blob column only inserts some of the data, in most
cases between 1 and 200 Bytes, but not allways the same and never all data
(which is in this case about 2 mb). I also tried it with
mysqli_stmt_send_long_data(), but that was not working either.
The table is as followes:
CREATE TABLE `dbfs_data_chunk` (
`fileid` smallint(5) unsigned NOT NULL,
`version` smallint(5) unsigned NOT NULL default '0',
`data` mediumblob,
PRIMARY KEY (`fileid`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
MySQL-Version: 5.0.15
If i do a base64_encode() it works, but this isn“t a solution, only a bad
workaround, which is not acceptable.
I also tried MyISAM, the same result.
Reproduce code:
---------------
<?php
$GLOBALS['CONN'] = mysqli_connect(...);
$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');
$one = 1;
$two = 2;
$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
exit;
?>
Expected result:
----------------
Should insert the binary data into the table
Actual result:
--------------
only 1 to 200 Bytes get inserted.
--
Edit bug report at http://bugs.php.net/?id=35155&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35155&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35155&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35155&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35155&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35155&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35155&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35155&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35155&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35155&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35155&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35155&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35155&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35155&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35155&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35155&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35155&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35155&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35155&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35155&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35155&r=mysqlcfg