From:             lars at strojny dot net
Operating system: Linux
PHP version:      5.1.4
PHP Bug Type:     MySQLi related
Bug description:  mysql_bind_param() and BLOB-fields

Description:
------------
Using mysqli in combination with the prepare-method and bind_param leads
to troubles with the BLOB-field. I'm not really sure if it is a bug or I
just thinking the wrong way.

Reproduce code:
---------------
<?php
$m = new mysqli( "host, "user", "pass" );
$m->select_db( "my_db" );
if( $statement = $m->prepare( "INSERT INTO my_table SET my_blob = ?" ))
{
   $file = file_get_contents( "image.png" );
   $statement->bind_param( 'b', $file );
   $statement->execute();
}
?>

Expected result:
----------------
Image should be inserted as binary data into the MySQL-table.

Actual result:
--------------
This does not work, it just puts zero bytes into the database. If I change
$statement->bind_param( 'b', $file ); to $statement->bind_param( 's', $file
); it works as expected

-- 
Edit bug report at http://bugs.php.net/?id=37421&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37421&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37421&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37421&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37421&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37421&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37421&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37421&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37421&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37421&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37421&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37421&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37421&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37421&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37421&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37421&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37421&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37421&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37421&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37421&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37421&r=mysqlcfg

Reply via email to