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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

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: Tue Oct 08 12:01:26 2024 UTC