From: lana0 at zahav dot net dot il
Operating system: XP SP2 Home edition
PHP version: 5.1.2
PHP Bug Type: MySQLi related
Bug description: mysqli does insert data
Description:
------------
extension php_mysqli.dll does not work properly in new release.
5.04 - it works
5.12 and 5.20SnapShort - it fails;
Reproduce code:
---------------
<?php
//grant create,insert,select,delete on test.* to
'testuser'@'localhost';
$db=mysqli_connect('localhost','testuser','','test');
echo "Php version: ".phpversion()."\n";
echo "Mysqli client version: ".mysqli_get_client_info()."\n";
echo "Mysqli server version: ".mysqli_get_server_info($db)."\n";
$Query='CREATE TABLE IF NOT EXISTS test.test (binData blob)';
$res=mysqli_query($db,$Query);
if ($res===TRUE){
$Query='insert into test.test set binData=?';
$binData="\0"; //BYTE ZERO!
$binData="123x\000567"; //TRY
$binData="12345";
$stmt =mysqli_prepare($db,$Query);
if (!$stmt){
echo "Fail on prepare!";
exit;
}
$res=mysqli_stmt_bind_param($stmt,'b',$binData);
$res=mysqli_stmt_execute($stmt);
if ($res){
$Query="select length(binData) as n from test.test";
$res=mysqli_query($db,$Query);
if ($res){
$row=mysqli_fetch_assoc($res);
if ($row){
mysqli_free_result($res);
echo "input strlen=".strlen($binData)."\n";
echo "stored strlen={$row['n']}"."\n";
mysqli_query($db,'delete from test.test');
}
}
}
}
exit;
?>
Expected result:
----------------
ver 5.0.4 works: (see strlen value)
R:\PhpMySQL>php blobcutzero.php
Php version: 5.0.4
Mysqli client version: 4.1.7
Mysqli server version: 5.0.16-nt
input strlen=5
stored strlen=5
Actual result:
--------------
new release fails: (see strlen value)
R:\PhpMySQL>php blobcutzero.php
Php version: 5.1.2
Mysqli client version: 4.1.7
Mysqli server version: 5.0.16-nt
input strlen=5
stored strlen=0
R:\PhpMySQL>php blobcutzero.php
Php version: 5.2.0-dev
Mysqli client version: 4.1.7
Mysqli server version: 5.0.16-nt
input strlen=5
stored strlen=0
--
Edit bug report at http://bugs.php.net/?id=37260&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37260&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37260&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37260&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37260&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37260&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37260&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37260&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37260&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37260&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37260&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37260&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37260&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37260&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37260&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37260&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37260&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37260&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37260&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37260&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37260&r=mysqlcfg