Call_user_func with PDO problem [PHP]


#1

Hello,

I’m trying to use call_user_func on dreamhost with pdo and don’t work. On my localhost ubuntu machine works.

Dreamhost: 5.2, 5.3 (FastCGI and CGI I already tried)
Local machine: PHP 5.3.10, Apache/2.2.22

Any ideas why i can’t use pdo with call_user_func?

[php]function do_query($function){
try{
$db = new_pdo(db_config()); // No details
$value = call_user_func_array($function, array($db)); // Why I can’t do this?
$db = null;
return $value;
}
catch(PDOException $e){
$logger->fatal($e->getMessage());
return false;
}
}
function test_query($db){
$stm = $db->prepare(“select * from users where id = :id”);
$stm->bindValue(’:id’,1);
$stm->execute();
var_dump($stm->errorInfo()); // This code throw 'Cannot execute queries while other unbuffered queries are active’
return $stm->fetchAll(); //No data
}

do_query(‘test_query’);

//Avoiding call_user_func
$db = new_pdo(db_config()); //No details
$stm = $db->prepare(“select * from users where id = :id”);
$stm->bindValue(’:id’,1);
$stm->execute();
var_dump($stm->errorInfo()); // No error
$stm->fetchAll(); // Works fine

[/php]