1. Don't forget __isset() with overloaded setters and getters

    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 __set() and __get() to do some extra checking on the fields. But overloading these functions also effects empty(). To make empty() behave normally __isset() must also be overloaded to test the used fields.

    And when implementing __isset() think about __unset(), maybe you need to overload it as well.

    The PHP Manual contains an example of overloading these magic members.