If you ever experience the php warning
Warning: Illegal offset type in foo.php on line 123
check the syntax in detail. Of course it might be, that you messed up and tried to insert an invalid key (e.g. an object) to an array like
$foo = array ('id');
$ary[$foo] = 1;
which obviously does and...