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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 16:01:33 2025 UTC