mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Allow java.lang.Hashtables to be passed into PHP as arrays.
This commit is contained in:
parent
7893c72965
commit
3f4c7c8359
4 changed files with 46 additions and 0 deletions
|
@ -45,6 +45,7 @@ public class reflect {
|
|||
private static native void setResultFromObject(long result, Object value);
|
||||
private static native void setResultFromArray(long result);
|
||||
private static native long nextElement(long array);
|
||||
private static native long hashUpdate(long array, byte key[]);
|
||||
private static native void setException(long result, byte value[]);
|
||||
public static native void setEnv();
|
||||
|
||||
|
@ -81,6 +82,15 @@ public class reflect {
|
|||
setResult(nextElement(result), Array.get(value, i));
|
||||
}
|
||||
|
||||
} else if (value instanceof java.util.Hashtable) {
|
||||
|
||||
Hashtable ht = (Hashtable) value;
|
||||
setResultFromArray(result);
|
||||
for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
|
||||
Object key = e.nextElement();
|
||||
setResult(hashUpdate(result, key.toString().getBytes()), ht.get(key));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
setResultFromObject(result, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue