php.net |  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
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: redeye at erisx dot de
New email:
PHP Version: OS:

 

 [2003-12-22 08:42 UTC] redeye at erisx dot de
Description:
------------
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:
---------------
<pre><?php

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";
}
?></pre>

Expected result:
----------------
empty page :-)

Actual result:
--------------
0 -> pub_function
1 -> priv_function

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-28 18:23 UTC] andrey@php.net
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] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2004-01-06 20:52 UTC] sniper@php.net
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-2022 The PHP Group
All rights reserved.
Last updated: Sun Nov 27 00:03:58 2022 UTC