|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2016-10-04 14:53 UTC] requinix@php.net
 
-Status: Open
+Status: Not a bug
-Type:   Feature/Change Request
+Type:   Bug
  [2016-10-04 14:53 UTC] requinix@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 11:00:01 2025 UTC | 
Description: ------------ I think empty($expression) is supposed to evaluate $expression before it checks if it is empty. In the code bellow, empty($obj->protectedProperty) is supposed to call __get before checking if it's empty. That makes sense, right? Well, I don't think it's happening. Sorry if I am missing something. But I think this behavior should change. Test script: --------------- $fooList = [ new Foo, new Foo ]; $bar = new Bar($fooList); var_dump(empty($bar->fooList)); // true $fooList = $bar->fooList; var_dump(empty($fooList)); // false class Foo { } class Bar { protected $fooList = []; public function __construct(array $fooList) { $this->fooList = $fooList; } public function __get(string $property) { return $this->$property; } }