[patch] bug #29210 is_callable - no support for private and protected classes

php.internals

Antony Dovgal

21 years ago
Hi all! Any volunteers to review & commit patch for #29210 ? Fresh diff against latest HEAD: http://tony2001.phpclub.net/dev/tmp/is_callable_HEAD.diff The patch adds support of protected/private methods to is_callable(), taking care of the context. test file: http://tony2001.phpclub.net/dev/tmp/is_callable.phpt x-posted to #php.bugs =)
-- Wbr, Antony Dovgal aka tony2001 antony@zend.com

Marcus Börger

21 years ago
Hello Antony, there is no need to fetch the instance (or create a temporairy one) since the function table is bound to the class rather then the instance. This is the major difference between real object oriented (sometimes referred to as prototype based like java script for instance) and class based. regards marcus Friday, February 18, 2005, 3:05:35 PM, you wrote:
> Hi all!
> Any volunteers to review & commit patch for #29210 ?
> Fresh diff against latest HEAD: > http://tony2001.phpclub.net/dev/tmp/is_callable_HEAD.diff
> The patch adds support of protected/private methods to is_callable(), > taking care of the context.
> test file: > http://tony2001.phpclub.net/dev/tmp/is_callable.phpt
> x-posted to #php.bugs =)
> -- > Wbr, > Antony Dovgal aka tony2001 > antony@zend.com
-- Best regards, Marcus mailto:helly@php.net

Antony Dovgal

21 years ago
On Fri, 18 Feb 2005 19:14:27 +0100 Marcus Boerger <helly@php.net> wrote:
> Hello Antony, > > there is no need to fetch the instance (or create a temporairy one) > since > the function table is bound to the class rather then the instance. > This is the major difference between real object oriented (sometimes > referred to as prototype based like java script for instance) and > class based.
Yeah, thanks for the hint, Marcus. Here is new version of the patch: http://tony2001.phpclub.net/dev/tmp/is_callable_new.diff
-- Wbr, Antony Dovgal aka tony2001 antony@zend.com

Andi Gutmans

21 years ago
Hi Antony, We have too many places that manually check access restrictions at this point. I would like to generalize it and use that in all places, and make it easier to fix problems like your patch does. Haven't had the time yet to dive deeply into it and see what the right way would be. For example, we have similar code in zend_std_get_method(). If you have any good ideas of how we can generalize it email me. Thanks, Andi At 05:05 PM 2/18/2005 +0300, Antony Dovgal wrote:

Antony Dovgal

21 years ago
On Thu, 17 Feb 2005 10:15:10 -0800 Andi Gutmans <andi@zend.com> wrote:
> Hi Antony, > > We have too many places that manually check access restrictions at > this point. I would like to generalize it and use that in all places, > and make it easier to fix problems like your patch does. Haven't had > the time yet to dive deeply into it and see what the right way would > be. For example, we have similar code in zend_std_get_method(). > > If you have any good ideas of how we can generalize it email me.
Ok, I'll try to look into this on the weekend.
-- Wbr, Antony Dovgal aka tony2001 antony@zend.com

Antony Dovgal

21 years ago
On Thu, 17 Feb 2005 10:15:10 -0800 Andi Gutmans <andi@zend.com> wrote:
> Hi Antony, > > We have too many places that manually check access restrictions at > this point. I would like to generalize it and use that in all places, > and make it easier to fix problems like your patch does. Haven't had > the time yet to dive deeply into it and see what the right way would > be. For example, we have similar code in zend_std_get_method(). > > If you have any good ideas of how we can generalize it email me.
As far as I can see zend_std_get_method() uses different semantics and zend_is_callable() is used for more general kind of checks. We can of course divide zend_is_callable() into several functions, but it would just add more mess IMO.
-- Wbr, Antony Dovgal aka tony2001 antony@zend.com