On Sun, 26 Jun 2011 23:36:28 +0100, Terin Stock <terinjo...@gmail.com>
I've been working with PHPTAL for quite some time, and have always been
annoyed that from within the template an object's __get method was being
ignored. I think I've tracked down the bug (in version 1.2.2, though it
still present in trunk).
The scenario: an object, exampleObject, implements __isset, but returns
false (exampleVariable is not set). exampleObject also implements __get,
and returns something that isn't NULL.
In PHP it's *not possible* for isset() to return false on something that
exists and has non-NULL value. I think __isset() and __get() emulate
behavior of isset() and $obj->property, so if you have something
if ( ! isset($obj->prop)) echo $obj->prop;
I think it's illogical or buggy. You're saying it's not set, but then you
expect it to be set anyway.
If you have lazily-loaded properties, then you should simply return *true*
from __isset() for such properties.
regards, Kornel Lesiński
PHPTAL mailing list