Antony, I don't at all disagree about the inappropriateness of this not triggering an error but I did want to point out that this behavior is not consistent with how __get() works. It seems like they should all behave similarly when dealing with overriding methods or properties of different access levels.
+++ Attempting to access a private property [EMAIL PROTECTED]:~$ php -r 'class A { private $a; } $a = new A; $a->a;' Fatal error: Cannot access private property A::$a in Command line code on line 1 +++ Attempting to access a private property when __get() is defined [EMAIL PROTECTED]:~$ php -r 'class A { private $a; public function __get($var) { echo $var, "\n"; } } $a = new A; $a->a;' a +++ Attempting to access a private method [EMAIL PROTECTED]:~$ php -r 'class A { private function a() {} } $a = new A; $a->a();' Fatal error: Call to private A::a() from invalid context in Command line code on line 1 ++ Attempting to access a private method when __call is defined [EMAIL PROTECTED]:~$ php -r 'class A { private function a() {} public function __call($method, $parms) { echo $method, "\n"; } } $a = new A; $a->a();' Fatal error: Call to private A::a() from invalid context in Command line code on line 1 On Sat, Aug 30, 2008 at 4:04 PM, Antony Dovgal <[EMAIL PROTECTED]> wrote: > On 31.08.2008 02:50, Diogo Neves wrote: > >> Exactly... >> >> Is that normal workings or more like a bugie one? >> > > Definitely not a bug. > > I believe the reason is that if you enable __call() in this case, you'd > have different behavior depending on the calling scope, i.e. complete mess. > Also there would be no way to know you're calling a method you're not > supposed to call (unless you trigger an error yourself). > > -- > Wbr, Antony Dovgal > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >