My guess: $obj->data->field "is" an object, and the class does not implement the __ isset () method, because you need it to use empty () this way.
What is he doing
echo "type:", gettype($obj->data), " class:", get_class($obj->data);
print?
standalone example to demonstrate the effect:
<?php class Bar { public $flag=false; public function __isset($key) { return $this->flag; } public function __get($key) { return '#'.$key.'#'; } } $foo = new StdClass; $foo->bar = new Bar; echo empty($foo->bar->test) ? 'empty':'not empty', ", ", $foo->bar->test, "\n"; $foo->bar->flag = true; echo empty($foo->bar->test) ? 'empty':'not empty', ", ", $foo->bar->test, "\n";
prints
empty, #test# not empty, #test#
source share