#26691 [Opn->Fbk]: Incorrect behaviour of PPP using get_class_methods([obj]);
| From: | sniper@php.net | Date: | Fri, 02 Jan 2004 02:07:16 +0000 |
| Subject: | #26691 [Opn->Fbk]: Incorrect behaviour of PPP using get_class_methods([obj]); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52686@lists.php.net to get a copy of this message | ||
ID: 26691
Updated by: sniper@php.net
Reported By: redeye at erisx dot de
-Status: Open
+Status: Feedback
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5.0.0b2 (beta2)
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2003-12-28 18:23:04] 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.
------------------------------------------------------------------------
[2003-12-22 08:42:38] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26691&edit=1