php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48481 get_class_methods behaviour in inherited classes
Submitted: 2009-06-05 13:17 UTC Modified: 2009-06-05 13:19 UTC
From: xsist10 at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.9 OS: Ubuntu 9.04
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: xsist10 at gmail dot com
New email:
PHP Version: OS:

 

 [2009-06-05 13:17 UTC] xsist10 at gmail dot com
Description:
------------
get_class_methods returns the parents methods when called from a protected/public function in the parent from an inherited child.

Reproduce code:
---------------
class Foo {
    function getFunctions() {
        return get_class_methods(__CLASS__);
    }
    
    function test1() {
    }
}

class Bar extends Foo {
    function test2() {
    }
}

$bar = new Bar();
print_r($bar->getFunctions());

Expected result:
----------------
Array ( [0] => getFunctions [1] => test1 [2] => test2 ) 

Actual result:
--------------
Array ( [0] => getFunctions [1] => test1 ) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-05 13:19 UTC] xsist10 at gmail dot com
return get_class_methods(__CLASS__);

should be:

return get_class_methods($this);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 20:01:35 2024 UTC