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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
44 - 7 = ?
Subscribe to this entry?

 
 [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-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 17:03:58 2023 UTC