#42016 [Opn->Fbk]: Call to a parent's parent method is allowed
| From: | derick@php.net | Date: | Tue, 17 Jul 2007 07:51:35 +0000 |
| Subject: | #42016 [Opn->Fbk]: Call to a parent's parent method is allowed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115129@lists.php.net to get a copy of this message | ||
ID: 42016
Updated by: derick@php.net
Reported By: reto at buxaprojects dot com
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: FreeBSD
PHP Version: 5.2.3
New Comment:
And why do you think this is a bug?
Previous Comments:
------------------------------------------------------------------------
[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