Maybe I’m asking a stupid question, but I can’t understand this behavior:
<?php
$this->meeting->google_id = 'test';
$test = $this->meeting->google_id;
var_dump(empty($test));
var_dump(empty($this->meeting));
var_dump(empty($this->meeting->google_id));
?>
gives output:
bool(false) bool(false) bool(true)
Why the result of empty($this->meeting->google_id); is true? And how should I check this property then?
Read here: http://www.php.net/manual/en/function.empty.php#93117
Basically, PHP magic methods resulting in unexpected behavior.
You can read/write to virtual members in a class if the class has a special
__getmagic method. The actual value, however, cannot be checked by the__issetmagic method (which is whatemptyuses), because it’s not an explicit member of the class.