#49946 [NEW]: mysqli_stmt_bind_param saying parameter 3 is value not a reference
| From: | chris at network-13 dot com | Date: | Wed, 21 Oct 2009 15:20:42 +0000 |
| Subject: | #49946 [NEW]: mysqli_stmt_bind_param saying parameter 3 is value not a reference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143762@lists.php.net to get a copy of this message | ||
From: chris at network-13 dot com
Operating system: Windows 7
PHP version: 5.3.0
PHP Bug Type: MySQLi related
Bug description: mysqli_stmt_bind_param saying parameter 3 is value not a reference
Description:
------------
I tested this on both linux/windows with PHP 5.2.10 and it gave no
problems. After updating the windows machine to PHP 5.3.0 it now gives the
error.
Warning: Parameter 3 to mysqli_stmt_bind_param() expected to be a
reference, value given
Reproduce code:
---------------
<?php
class db {
public $result;
function getresult(){
$connection = mysqli_connect('localhost', 'root', 'password',
'testdb');
$args = func_get_args();
$query = array_shift($args);
if(!$connection){ mysqli_connect_error(); exit(); }
$sql = mysqli_prepare($connection, $query);
$types = str_repeat('s', count($args));
array_unshift($args, $types);
array_unshift($args, $sql);
call_user_func_array('mysqli_stmt_bind_param', $args);
mysqli_stmt_execute($sql);
mysqli_stmt_bind_result($sql, $result);
mysqli_stmt_fetch($sql);
mysqli_close($connection);
$this->result = $result;
}
}
$uid = NEW db();
$uid->getresult("SELECT uid FROM testtable WHERE user = ?","Chris");
echo $uid->result;
?>
Expected result:
----------------
It should echo the uid of the user.
Actual result:
--------------
Warning: Parameter 3 to mysqli_stmt_bind_param() expected to be a
reference, value given in D:\www\mysqli2.php on line 16
--
Edit bug report at http://bugs.php.net/?id=49946&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49946&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49946&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49946&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49946&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49946&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49946&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49946&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49946&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49946&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49946&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49946&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49946&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49946&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49946&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49946&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49946&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49946&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49946&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49946&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49946&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49946&r=mysqlcfg