Edit report at https://bugs.php.net/bug.php?id=64592&edit=1
ID: 64592
Comment by: benjamin dot morel at gmail dot com
Reported by: benjamin dot morel at gmail dot com
Summary: ReflectionClass::getMethods() returns methods out of
scope
Status: Open
Type: Bug
Package: Reflection related
Operating System: Linux
PHP Version: 5.4.13
Block user comment: N
Private report: N
New Comment:
@johannes too bad this comes up just a few days after the feature freeze for
5.5 :(
No chance this could be considered a bug, not a feature, and make it into 5.5?
I personally don't think it would be a huge problem, as most existing libraries
probably haven't started to modify their code for 5.5 compatibility, so it
could
still be time to fix it?
Previous Comments:
------------------------------------------------------------------------
[2013-04-08 08:04:23] [email protected]
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] [email protected]
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] [email protected]
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