Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-27 Thread Stanislav Malyshev
Hi! - B1 and B2 both extend A. B2 is neither an ancestor nor a descendant of B1, but I suppose they could be considered to be part of the same class hierarchy because they are siblings. - f() is declared as protected in A and B1, but not declared at all in B2. Which means there exists A::f

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-27 Thread Robin Fernandes
Hi all, thanks for thinking about this. On 26/03/2008, Marcus Boerger <[EMAIL PROTECTED]> wrote: > On 26/03/2008, Alexey Zakhlestin <[EMAIL PROTECTED]> wrote: > > > use case for "protected" is similiar, but relates to cases when you > > have hierarchy of classes, which still have some common fu

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-27 Thread Lokrain
Hello Internals, This discussion was very interesting to me so I made some research about all languages OOP. Each time I saw definition of public, protected, private there was an explanation which never mentioned instances, but classes. I certainly thought that Richard is right saying: Surely it

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Richard Lynch
On Mon, March 24, 2008 8:16 pm, Felipe Pena wrote: > Do we keep the support added in http://bugs.php.net/bug.php?id=37632 > (that isn't supported in C++, for instance) or fix the > zend_is_callable_check_func() ? Personally, it makes sense to me for a PROTECTED function (et al) with a common proto

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Stanislav Malyshev
It just doesn't seem right to be able to call a private or protected method of another instance. Sort of isn't private any more. Why not? Private/protected is meant to separate APIs, it's not a security check on objects. Private means this API belongs to this class only, protected means this A

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Stanislav Malyshev
This still will works. Surely it shouldn't work at all unless the $foo === $this? Why not? If the context is right, why shouldn't it be able to call this content's protected functions? As I understand, protected funciton means no code outside the class can call it, since it's not a part of t

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Marcus Boerger
Hello Alexey, Wednesday, March 26, 2008, 6:05:12 PM, you wrote: > On 3/26/08, Richard Quadling <[EMAIL PROTECTED]> wrote: >> It just doesn't seem right to be able to call a private or protected >> method of another instance. Sort of isn't private any more. >> And as for being able to call a

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Alexey Zakhlestin
On 3/26/08, Richard Quadling <[EMAIL PROTECTED]> wrote: > It just doesn't seem right to be able to call a private or protected > method of another instance. Sort of isn't private any more. > And as for being able to call a protected method of a completely > different class, just because it sh

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Richard Quadling
On 26/03/2008, Richard Quadling <[EMAIL PROTECTED]> wrote: > On 25/03/2008, Felipe Pena <[EMAIL PROTECTED]> wrote: > > > Em Ter, 2008-03-25 às 12:35 +0100, Lars Strojny escreveu: > > > > > Would that mean that the following code does not work anymore? > > > > > > > > class Foo > > > { >

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Alexey Zakhlestin
On 3/26/08, Richard Quadling <[EMAIL PROTECTED]> wrote: > Shouldn't the instance be the limiting factor? it shouldn't public/protected/private are related to classes, not to objects. -- Alexey Zakhlestin http://blog.milkfarmsoft.com/ -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-26 Thread Richard Quadling
On 25/03/2008, Felipe Pena <[EMAIL PROTECTED]> wrote: > Em Ter, 2008-03-25 às 12:35 +0100, Lars Strojny escreveu: > > > Would that mean that the following code does not work anymore? > > > > > class Foo > > { > > protected function method() > > { > > } > > > > publ

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-25 Thread Felipe Pena
Em Ter, 2008-03-25 às 12:35 +0100, Lars Strojny escreveu: > Would that mean that the following code does not work anymore? > > class Foo > { > protected function method() > { > } > > public function doSomething(Foo $foo) > { > $foo->method(); > }

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-25 Thread Lars Strojny
Hi, Am Dienstag, den 25.03.2008, 11:04 + schrieb Robin Fernandes: [...] > My preference would be to completely remove this behaviour, by which > protected methods can be invoked from outside of their declaring > class's hierarchy. In other words, remove all uses of > zend_get_function_root_cla

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-25 Thread Robin Fernandes
Hi Felipe, On 25/03/2008, Felipe Pena <[EMAIL PROTECTED]> wrote: > Hello, > > Do we keep the support added in http://bugs.php.net/bug.php?id=37632 > (that isn't supported in C++, for instance) My preference would be to completely remove this behaviour, by which protected methods can be invoked

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-03-24 Thread Felipe Pena
Hello, Do we keep the support added in http://bugs.php.net/bug.php?id=37632 (that isn't supported in C++, for instance) or fix the zend_is_callable_check_func() ? Thanks. 2008/2/5, Robin Fernandes <[EMAIL PROTECTED]>: > Hi all, > > The fix to bug 37212 (http://bugs.php.net/bug.php?id=37632) in

Re: [PHP-DEV] Inconsistencies when accessing protected members

2008-02-05 Thread Felipe Pena
Hi all, in my point view, the zend_check_protected should be used like: http://ecl.mediain.com.br/diff/protected.diff This patch breaks a test (Zend/tests/bug37632.phpt): class A1 { protected function test() { echo __METHOD__ . "\n"; } } class B1 extends A

[PHP-DEV] Inconsistencies when accessing protected members

2008-02-05 Thread Robin Fernandes
Hi all, The fix to bug 37212 (http://bugs.php.net/bug.php?id=37632) introduced an unusual method accessibility rule. A class can access a protected method declared outside of its own direct class hierarchy if that method has a prototype in a common superclass. This is achieved using by zend_get