Edit report at https://bugs.php.net/bug.php?id=64592&edit=1
ID: 64592
Updated by: johannes@php.net
Reported by: benjamin dot morel at gmail dot com
Summary: ReflectionClass::getMethods() returns methods out of
scope
-Status: Assigned
+Status: Open
Type: Bug
Package: Reflection related
Operating System: Linux
PHP Version: 5.4.13
-Assigned To: johannes
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2013-04-08 08:04:23] johannes@php.net
In general reflection in PHP leaks the "truth" by not hiding implementation details. This
falls into this category. Telling the truth is nice for maintainers but not really for users.
We can't change it in released (or feature frozen) versions so 5.6 might be an option. For that
we might collect more such cases and think about ringing Reflection on some higher level of
abstraction.
------------------------------------------------------------------------
[2013-04-07 12:53:40] felipe@php.net
Hey Johannes, what do you think about this behavior? Since reflection has worked in this way for a
long time...
------------------------------------------------------------------------
[2013-04-06 16:25:28] benjamin dot morel at gmail dot com
@felipe, did you read the bug before closing it? We're not talking about "not
accessible", but "not in scope".
This is totally different.
The fact is, if you run my example, getMethods() and getProperties() do not behave
in the same way, thus either this is a bug in getMethods(), and if not, this is a
bug in getProperties().
But I'm pretty sure it's getProperties() that behaves correctly here.
Could you please comment on this?
------------------------------------------------------------------------
[2013-04-06 15:27:46] felipe@php.net
It is not intended to just show the accessible ones, hence we already have introduced method like
ReflectionMethod::setAccessible().
------------------------------------------------------------------------
[2013-04-06 15:11:19] benjamin dot morel at gmail dot com
Works like a charm with your patch, thanks!
Any chance that gets into 5.4, or at least 5.5 (if there is a fear of breaking BC
with existing libraries that would rely on this behaviour)?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64592--
Edit this bug report at https://bugs.php.net/bug.php?id=64592&edit=1