I found the answer to my problem in a user note by fabio at kidopi dot com dot br3 years ago on the PHP manual page of mysqli_stmt::bind_param() (slightly modified):
I used to have problems with call_user_func_array
and bind_param
after migrating to php 5.3.
The cause is that 5.3 requires array values as reference while 5.2 worked with real values (but also with references). So I created a secondary helper function to help me with this:
function refValues($arr)
{
$refs = array();
foreach ($arr as $key => $value)
{
$refs[$key] = &$arr[$key];
}
return $refs;
}
and changed my previous function from:
call_user_func_array(array($this->stmt, "bind_param"), $this->values);
to:
call_user_func_array(array($this->stmt, "bind_param"), refValues($this->values));
This way my db functions keep working in PHP 5.2/5.3 servers.