#33277 [Opn->Asn]: private method accessed by child class

From: Date: Sat, 11 Jun 2005 17:48:32 +0000
Subject: #33277 [Opn->Asn]: private method accessed by child class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-80174@lists.php.net to get a copy of this message
 ID:               33277
 Updated by:       sniper@php.net
 Reported By:      stas@php.net
-Status:           Open
+Status:           Assigned
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5CVS-2005-06-08 (dev)
 Assigned To:      stas


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

[2005-06-08 18:32:43] stas@php.net

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 this bug report at http://bugs.php.net/?id=33277&edit=1


Thread (3 messages)

« previous php.bugs (#80174) next »