My information was incomplete: I'm running php 5.1.2 (a requirement from the
customer).
I found this http://bugs.php.net/bug.php?id=42937
I "coded" this without testing, using only the idea. Thanks!
Thanks for the help Nathan!
2008/8/27 Nathan Nobbe <[EMAIL PROTECTED]>
> On Wed, Aug 27, 2008 at 1:49 PM, Nathan Nobbe <[EMAIL PROTECTED]>wrote:
>
>> On Wed, Aug 27, 2008 at 1:35 PM, Paulo Sousa <[EMAIL PROTECTED]
>> > wrote:
>> ...
>>
>
> this *should* work,
>
> here is a test, tests/classes/__call_005.phpt, you can take the part
> beneath the --FILE-- section and see if it blows up on your system or not.
> right now, im getting errors on a php5.2.5 system, and its working as
> expected on a php5.2.6 system.
>
> --TEST--
> When __call() is invoked via ::, ensure private implementation of __call()
> in superclass is accessed without error.
> --FILE--
> <?php
> class A {
> private function __call($strMethod, $arrArgs) {
> echo "In " . __METHOD__ . "($strMethod, array(" .
> implode(',',$arrArgs) . "))\n";
> var_dump($this);
> }
> }
>
> class B extends A {
> function test() {
> A::test1(1,'a');
> B::test2(1,'a');
> self::test3(1,'a');
> parent::test4(1,'a');
> }
> }
>
> $b = new B();
> $b->test();
> ?>
> --EXPECTF--
> In A::__call(test1, array(1,a))
> object(B)#1 (0) {
> }
> In A::__call(test2, array(1,a))
> object(B)#1 (0) {
> }
> In A::__call(test3, array(1,a))
> object(B)#1 (0) {
> }
> In A::__call(test4, array(1,a))
> object(B)#1 (0) {
> }
>
> also, i found in the code you posted, you are missing a 'function' in front
> of doWhatever (cause a parse error, which is why i mention it); w/ the
> following modification to your code, its running fine on a php 5.2.6 system,
> and choking on 5.2.5;
>
> function __call($function, $args){
> var_dump($function);
> var_dump($args);
> $this->doWhatever();
> }
>
> private function doWhatever() {
> }
>
> [EMAIL PROTECTED] ~/unpack/php-5.2.6RC3/tests/classes $ php testOtherStuff.php
> string(5) "drive"
> array(1) {
> [0]=>
> string(7) "testing"
> }
>
> -nathan
>
> (sorry for the long-winded post)
>