From: [EMAIL PROTECTED] Operating system: Linux, RH6.2 PHP version: 4.0.4pl1 PHP Bug Type: Class/Object related Bug description: Java support corrupts Hashtables This bug is with the Java support in PHP4. PHP seems to try to treat Java Hashtable objects as PHP-native arrays, with several negative impacts. First of all, Java Hashtables have no internal concept of ordering or null termination, nor do they have an internal "current" pointer. Therefore, if you try to travserse a Java Hashtable as you would a PHP array, you will run off the end! However, since the Hashtable is not an object (under PHP), you cannot call $my_hash->get( "x" ) or $my_hash->put( "y" ). Second of all, if you try to pass such a Hashtable BACK to a Java class method, you will find that the Hashtable has been corrupted, and all your datatypes changed and you will get various NullPointerExceptions or illegal cast exceptions. It seems to me the most natural approach at this point would be to just treat Java Hashtables as generic objects, and therefore retain the get() and put() methods. That way you don't corrupt the Hashtable, and you don't let anyone go off the end of any arrays. I don't know if this kind of thing happens with other Java object classes. There is a workaround whereby one can, in Java, explicitly repair a corrupted Hashtable, but that is pretty ugly. If you are interested in looking at the workaround, email me. Here is a code snippet illustrating what I mean: MyClass.java: public class MyClass { public MyClass() { } public Hashtable makeHash( int ikey, int ival, String skey, String sval ) { Hashtable myhash = new Hashtable(); myhash.put( ikey, ival ); myhash.put( skey, sval ); myhash.put( "myname", "joe" ); return myhash; } public String getSomething( Hashtable myhash ) { return myhash.get( "myname" ); } } MyPage.php <? $my_java = new Java( "MyClass" ); $my_hash = my_java->makeHash( 1,2,"yourname", "steve" ); // watch this: print( implode( ",", $my_hash ) ); // explosion! off the end of the array // or, print( $my_java->getSomething() ); // java exception! ?> -- Edit Bug report at: http://bugs.php.net/?id=9162&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]