On Sun, 7 Aug 2005, Nuno Lopes wrote:
@@ -8,8 +8,13 @@
__call, __get and __set methods. These methods will only be
triggered when your object or inherited object doesn't contain the
member or method you're trying to access.
- All overloading methods must be defined as
- <link linkend="language.oop5.visibility">public</link>.
+ All overloading methods must not be defined as
+ <link linkend="language.oop5.visibility">static</link>.
Uh?
@@ -43,9 +56,9 @@
public $n;
private $x = array("a" => 1, "b" => 2, "c" => 3);
- public function __get($nm)
+ private function __get($nm)
? They need to be public...
regards,
Derick
At least in latest HEAD, they don't.
excerpt from zend_register_functions (Zend/zend_api.c:1421-1627):
if (__get) {
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static",
scope->name, __get->common.function_name);
}
(the same is repeated for the other methods)
So, it only check if the method is static or not.
And IMHO, it might be a good politic to declare those methods as private or
protected to avoid external abuses.
Nuno