From: gabriel at oxeva dot fr
Operating system: Linux 2.6
PHP version: 5.3CVS-2007-12-11 (snap)
PHP Bug Type: MySQLi related
Bug description: mysqli statement stmt->bind_param doesn't work when called by
call_user_func
Description:
------------
The Mysqli method stmt->bind_param() doesn't work when called by
call_user_func_array. Too bad Zend Framework is using this method with the
Mysqli driver.
In the following example, call_user_func_array always return NULL, but
directly calling $stmt->bind_param() works and return the correct
bool(true) value.
Note: this works in PHP 5.2
Note: The same error occurs using either libmysqlclient or mysqlnd.
Final note: ATM the PDO_mysql driver works. But leaving a bug like this in
the mysqli driver is not an option :-)
Reproduce code:
---------------
$my = new mysqli('localhost', 'test', 'test', 'testdb');
$stmt = $my->prepare('INSERT INTO `car` (`brand`, `brand_id`, `car_type`)
VALUES (?, ?, ?)');
$param = array('sss', 'GMC', 1, 'SUV');
$return = call_user_func_array(array($stmt, 'bind_param'), $param);
var_dump($return);
$stmt->execute();
echo $stmt->errno, ':', $stmt->error;
Expected result:
----------------
var_dump($return) prints bool(true)
No error returned in $stmt->errno / $stmt->error
Actual result:
--------------
var_dump($return) prints NULL
Statement error is returned:
2031:No data supplied for parameters in prepared statement
--
Edit bug report at http://bugs.php.net/?id=43568&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43568&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43568&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43568&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43568&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43568&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43568&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43568&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43568&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43568&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43568&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43568&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43568&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43568&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43568&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43568&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43568&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43568&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43568&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43568&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43568&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43568&r=mysqlcfg