__isset() and null value
| From: | Michael Voříšek - ČVUT FEL | Date: | Fri, 04 Sep 2020 17:03:29 +0000 |
| Subject: | __isset() and null value | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-111843@lists.php.net to get a copy of this message | ||
isset() returns false for null
__isset() should return the same, but then if magic property with null
value exists, there is no way to detect it
Example: https://3v4l.org/GqUsh
this is currently an limitation of php
Ideally, we should introduce __exist() which should return true even if
value is null and for BC autoimplement __isset() based on it and __get,
ie.
function __isset($n) { return $this->__exist($n) && $this->__isset($n)
!== null; }
With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem,
Michael Voříšek