mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Allow non-public enumerations to be accessed
This commit is contained in:
parent
18f57df605
commit
08dc9ba24f
2 changed files with 34 additions and 0 deletions
|
@ -197,6 +197,23 @@ class reflect {
|
|||
public static void Invoke
|
||||
(Object object, String method, Object args[], long result)
|
||||
{
|
||||
|
||||
// Apparently, if a class is not declared "public" it is illegal to
|
||||
// access a method of this class via Invoke. We can't work around
|
||||
// all such cases, but enumeration does appear to be a common case.
|
||||
if (object instanceof Enumeration && args.length == 0) {
|
||||
|
||||
if (method.equalsIgnoreCase("hasMoreElements")) {
|
||||
setResultFromBoolean(result, ((Enumeration)object).hasMoreElements());
|
||||
return;
|
||||
}
|
||||
|
||||
if (method.equalsIgnoreCase("nextElement")) {
|
||||
setResultFromObject(result, ((Enumeration)object).nextElement());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Vector matches = new Vector();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue