This post is mostly a marker for me to find the solution for this problem in the future. What problem? Well, a call using
empty()to test a class field always returned true even if the field wasn’t empty.
The reason for this behavior is that the class overloads
__get()to do some extra checking on the fields. But overloading these functions also effects
empty(). To make
__isset()must also be overloaded to test the used fields.
And when implementing
__unset(), maybe you need to overload it as well.
The PHP Manual contains an example of overloading these magic members.