Howdy,
I was working away with revision 122 and decided to update it earlier tonight to revision 131 because there had been several interesting-looking changes.
I just found one thing that caused a bug in my application.
I have a users object, and I was setting some datetime fields to NULL (db schema allows NULL)
$User->set('date_approved', NULL);
...
$User->save();
I now get an error when I save, whereas I did not before.
I traced through the code and found that in pdo.class.php, when the execute method is replacing bound parameters, it was just replacing the parameter with an empty string, where I would have expected NULL. So the SQL statement had this " ’stuff’, ’thing’, , ,’’) " kinda problem.
I haven’t taken the time to understand exactly what this method is doing, but I added one line, $v= NULL, as shown here:
if (!$v) {
switch ($type) {
case PDO_PARAM_INT:
$v= '0';
break;
case PDO_PARAM_BOOL:
$v= '0';
break;
default:
$v= 'NULL';
break;
}
}
This has solved my problem, but I don’t know if it is the proper fix. I’m not sure about what that "if(!$v)" test is trying to do; maybe the change should be up there instead?