From:             julien dot a at laposte dot net
Operating system: Windows XP SP2
PHP version:      5.0.4
PHP Bug Type:     Class/Object related
Bug description:  wrong method called

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 bug report at http://bugs.php.net/?id=33835&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33835&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33835&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33835&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33835&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33835&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33835&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33835&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33835&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33835&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33835&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33835&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33835&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33835&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33835&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33835&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33835&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33835&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33835&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33835&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33835&r=mysqlcfg

Reply via email to