From: camka at email dot ee
Operating system: win xp
PHP version: 5.1.2
PHP Bug Type: MySQLi related
Bug description: error on binding result parameter for prepared statement
Description:
------------
When trying to bind a result variable to a prepared statement the error
"Using unsupported buffer type: 253" comes up.
Moreover, the binded in paramter doesn't get binded correctly either as
seen from mysql log.
The other strange thing is that, if field datatype varchar(15) (< then 16)
is used for tm table, than error 253 won't come up, buth the problem with
binded parameter remains. Integer type works without the error as well.
Tested with both current stable php version and the latest snapshot (Built
On: Feb 14, 2006 11:30 GMT)
Reproduce code:
---------------
<?php
echo "PHP version: ".phpversion();
$m = new mysqli('localhost','***','***','***');
$v = $m->query("select @@version as v")->fetch_assoc();
echo "\nMySQL version: ".$v['v'];
$m->query("create temporary table tm (txt varchar(16))");
$m->query("insert into tm (txt) values ('2'),('3'),('4')");
$v = $m->query("select count(*) as v from tm")->fetch_assoc();
echo "\nNum of recs: ".$v['v'];
$str = "select txt from tm where txt=?";
$ps = $m->prepare($str);
$txt_in = '2';
$txt_out = null;
if (!$ps->bind_param('s', $txt_in)) echo "\nbind_param: ".$ps->error;
if (!$ps->bind_result($txt_out)) echo "\nbind_result: ".$ps->error;
if ($ps->execute()) echo "\nexecuted successfully:
".$ps->num_rows;
else echo "\nfailed ps execution:
".$ps->error;
if (!$ps->store_result()) echo "\nstore_result: ".$ps->error;
if ($z = $ps->fetch()) echo "\nfetched successfully:
".$txt_out;
elseif($z === false) echo "\nfailed fetching:
".$ps->error;
elseif($z === null) echo "\nno more records";
?>
Expected result:
----------------
PHP version: 5.1.2
MySQL version: 5.0.18-nt-log
Num of recs: 3
executed successfully: 0
fetched successfully: 1
Actual result:
--------------
PHP version: 5.1.2
MySQL version: 5.0.18-nt-log
Num of recs: 3
bind_result: Using unsupported buffer type: 253 (parameter: 1)
executed successfully: 0
no more records
[mysql log file]
58 Query select @@version as v
58 Query create temporary table tm (txt varchar(16))
58 Query insert into tm (txt) values ('2'),('3'),('4')
58 Query select count(*) as v from tm
58 Prepare [1]
58 Execute [1] select txt from tm where txt=0
--
Edit bug report at http://bugs.php.net/?id=36389&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36389&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36389&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36389&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36389&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36389&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36389&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36389&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36389&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36389&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36389&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36389&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36389&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36389&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36389&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36389&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36389&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36389&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36389&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36389&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36389&r=mysqlcfg