#33277 [NEW]: private method accessed by child class

From: Date: Wed, 08 Jun 2005 16:32:43 +0000
Subject: #33277 [NEW]: private method accessed by child class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-80072@lists.php.net to get a copy of this message
From:             stas@php.net
Operating system: *
PHP version:      5CVS-2005-06-08 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  private method accessed by child class

Description:
------------
Code below produces "private!" - meaning that object is allowed to access
private methods of the parent class, which is, of course, wrong. 

Reproduce code:
---------------
<?
class foo {
        private function bar() {
                echo "private!\n";
        }
}
 
class fooson extends foo {
        function barson() {
                $this->bar();
        }
}
 
class foo2son extends fooson {
 
        function bar() {
                echo "public!\n";
        }
}
 
$b = new foo2son();
$b->barson();
?>


Expected result:
----------------
public!

Actual result:
--------------
private!

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


Thread (3 messages)

« previous php.bugs (#80072) next »