php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37654 covering private method
Submitted: 2006-05-31 15:24 UTC Modified: 2006-05-31 15:38 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: mjarco at zhr dot pl Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.1.4 OS: Windows/Linux
Private report: No CVE-ID: None
 [2006-05-31 15:24 UTC] mjarco at zhr dot pl
Description:
------------
I think there is a bug when you want to cover private method in child class, and run it by public inherited method. See example:

Reproduce code:
---------------
class Bar
{
    private function shmoo()
    {
        print 'bar';
    }
    
    public function exe()
    {
        $this->shmoo();
    }
}

class FooBar extends Bar
{
//change to protected, and public see what happens
    private function shmoo()
    {
        print 'foobar';
    }
}
$bar = new FooBar;
$bar->exe();

Expected result:
----------------
foobar

Actual result:
--------------
bar

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-31 15:38 UTC] tony2001@php.net
This is called "late static binding" and we're still thinking on the best implementaion of it.
Until then -> won't fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC