ID:               42016
 Updated by:       [EMAIL PROTECTED]
 Reported By:      reto at buxaprojects dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
-Operating System: FreeBSD
+Operating System: *
-PHP Version:      5.2.3
+PHP Version:      *
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It is just the way it works. If it sees it is coming from the right
context this call version doe snot enforce a static call. Instead it
will simply keep $this and be happy with it.


Previous Comments:
------------------------------------------------------------------------

[2007-07-17 08:17:25] reto at buxaprojects dot com

Because a non-static method should not be called statically! This
should also apply for a parents parent class! Class C and B should only
be able to call parent:: . If class C must access the method test() of
class A, class B shouldn't override the method test().

------------------------------------------------------------------------

[2007-07-17 07:51:34] [EMAIL PROTECTED]

And why do you think this is a bug?

------------------------------------------------------------------------

[2007-07-17 06:24:58] reto at buxaprojects dot com

Description:
------------
I expected, that i cannot call a non-static method in a parent's parent
class with ParentClassName::method() from a child class. But it works
even on E_STRICT. I think this should be a bug!

Reproduce code:
---------------
class A {
    private $myVar;   
    public function test() { 
        $this->myVar = 'test';
        echo 'A::test()' . "\n";
    }
}
class B extends A { 
    public function test() { 
        echo 'B::test()' . "\n"; 
    }
}
class C extends B { 
    public function test() 
    { 
        echo 'C::test()' . "\n";
        A::test();
    }
} 
$c = new C; 
$c->test();

Expected result:
----------------
Non-static method A::test() should not be called statically

Actual result:
--------------
C::test
A::test


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42016&edit=1

Reply via email to