#33835 [Opn->Bgs]: wrong method called
| From: | sniper@php.net | Date: | Sat, 23 Jul 2005 12:47:16 +0000 |
| Subject: | #33835 [Opn->Bgs]: wrong method called | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82353@lists.php.net to get a copy of this message | ||
ID: 33835
Updated by: sniper@php.net
Reported By: julien dot a at laposte dot net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Windows XP SP2
PHP Version: 5.0.4
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
RTFM: "When an extending class overrides the parents definition of a
method, PHP will not call the parent's method."
Previous Comments:
------------------------------------------------------------------------
[2005-07-23 11:28:07] julien dot a at laposte dot net
Description:
------------
I saw bug reports about self similar to this bug but i don't really
know if both are related so I decided to post it, sorry if it is the
same bug.
I tested for this bug on 5.0.4 and on latest 5.1 snapshot and it is
still there, if the "func" methods are not private or if they are
protected it works as expected and the result is "B::func()" but if
they are private the result is not what is expected.
Reproduce code:
---------------
class A{
private function func(){
echo "A::func()\n";
}
function test(){
$this->func();
}
}
class B extends A{
private function func(){
echo "B::func()\n";
}
}
$v= new B();
$v->test();
Expected result:
----------------
B::func()
Actual result:
--------------
A::func()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33835&edit=1