I would think the following piece of code should work, but it doesn\'t (Edited: Now works in PHP 5.5+):
if (!empty($r->getError()))
The alternative way to check if an array is empty could be:
count($array)>0
It works for me without that error