php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33277 private method accessed by child class
Submitted: 2005-06-08 18:32 UTC Modified: 2005-06-17 12:51 UTC
From: stas@php.net Assigned: stas
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-06-08 (dev) OS: *
Private report: No CVE-ID:
 [2005-06-08 18:32 UTC] 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!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-17 12:51 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_0.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 08:02:55 2014 UTC