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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stas@php.net
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC