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()))
Prior to PHP 5.5, the the PHP docs used to say:
empty() only checks variables as anything else will result in a parse error
In PHP < 5.5 you weren't able use empty()
directly on a function's return value. Instead, you could assign the return from getError()
to a variable and run empty()
on the variable.
In PHP >= 5.5 this is no longer necessary.