|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26691 Incorrect behaviour of PPP using get_class_methods([obj]);
Submitted: 2003-12-22 08:42 UTC Modified: 2004-01-06 20:52 UTC
From: redeye at erisx dot de Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.0b2 (beta2) 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: redeye at erisx dot de
New email:
PHP Version: OS:


 [2003-12-22 08:42 UTC] redeye at erisx dot de
Calling get_class_methods([obj]); on an object returns next to public methods it's private and protected methods. I guess those methods should only be returned when calling get_class_methods($this); within an object.

Reproduce code:

class test {
    public function pub_function() {
        // some code
    private function priv_function() {
        // some code

$test = new test;
$arry = get_class_methods($test);

foreach ( $arry AS $n => $method_name ) {
    echo $n." -> ".$method_name."\n";

Expected result:
empty page :-)

Actual result:
0 -> pub_function
1 -> priv_function


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-28 18:23 UTC]
Well, there are more inconsistencies - like print_r() which can dump values of protected/private values (var_dump() does not do that). print_r() relies on internals of Zend and this is why it prints the info about private/protected vars. Back to the current topic, imo it's not a problem that you can see what's behind since private/protected methods cannot be called outside of the $this context.
 [2004-01-01 21:07 UTC]
Please try using this CVS snapshot:
For Windows:

 [2004-01-06 20:52 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 17:03:58 2023 UTC