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 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-06-08 (dev) OS: *
Private report: No CVE-ID: None
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC