From: mike dot norton at ultisearch dot co dot uk
Operating system: Fedora Core 3
PHP version: 5.0.4
PHP Bug Type: MySQLi related
Bug description: prepared statment using blobs doesnt function
Description:
------------
When using mysql with bind_params on blob data only the first 4 bytes of
data get included.
Reproduce code:
---------------
<?php
$mysqli = new mysqli("localhost", "user", "pass", "db");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$filename = "/path_to/files/5_copy14.jpg";
/* create a prepared statement */
$stmt = $mysqli->stmt_init();
$stmt->prepare("insert into user_image (image) values (?)");
$data = fread(fopen($filename, "rb"), filesize($filename));
$stmt->bind_param('b',$data); /* Prove that the $data variable
contains the correct data */
print $data;
$stmt->execute();
$stmt->close();
$mysqli->close();
?>
Expected result:
----------------
Image is displayed and image data is inserted into database
Actual result:
--------------
First 4K of image is inserted into database rest seems to be discarded
--
Edit bug report at http://bugs.php.net/?id=34022&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34022&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34022&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34022&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34022&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34022&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34022&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34022&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34022&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34022&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34022&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34022&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34022&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34022&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34022&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34022&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34022&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34022&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34022&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34022&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34022&r=mysqlcfg