Quote from the PHP documentation on overloading:
It is not possible to use overloaded properties in other language constructs than isset(). This means if empty() is called on an overloaded property, the overloaded method is not called.
To workaround that limitation, the overloaded property must be copied into a local variable in the scope and then be handed to empty().
Does this really mean that I cannot use something like
if (empty($this->foobar))
in a class, where $this->foobar
is a magic property, resolved through __get()
, or am I misunderstanding something here?