From: <php...@li...> - 2007-05-29 18:10:24
|
With strings, that is. Is it expected behavior that Integers, Floats, Doubles, and Longs need to be converted with java_values() before being used in a PHP context? For example, $integer =3D new Java('java.lang.Integer', 123); // displays [[o:Integer]:"123"] echo $integer; // displays notice "could not be converted to int" and 'not equal' if ($integer =3D=3D 123) echo 'equal'; else echo 'not equal'; // displays 123 echo java_values($integer); // displays 'equal' if (java_values($integer) =3D=3D 123) echo 'equal'; else echo 'not equal'; =20 Thanks for your help, Jonathan Abbett > -----Original Message----- > From: php...@li...=20 > [mailto:php...@li...]=20 > On Behalf Of php...@li... > Sent: Tuesday, May 29, 2007 11:14 AM > To: php...@li... > Subject: Re: [Php-java-bridge-users] java_values? >=20 > I just upgraded to 5.2.2, and have confirmed that the problem=20 > is fixed. > Thanks!=20 >=20 >=20 > > -----Original Message----- > > From: php...@li...=20 > > [mailto:php...@li...]=20 > > On Behalf Of php...@li... > > Sent: Saturday, May 26, 2007 6:42 AM > > To: php...@li... > > Subject: Re: [Php-java-bridge-users] java_values? > >=20 > > Hi Jonathan, > >=20 > > the bug described below has been fixed in PHP version > > 5.2.0 and above. (I am not sure, but I think PHP 5.1.6 > > contains the same fix). > >=20 > > Please use this version instead. > >=20 > >=20 > > > These echoes, however, do not: > > >=20 > > > $string =3D new Java('java.lang.String', 'abc'); > > > echo "This is my $string" . "\n"; > > > echo "This is my " . $string . "\n"; > > > echo $string " is my string" . "\n"; > > >=20 > > > The result I see is: > > >=20 > > > This is my Object id #30 > > > This is my Object id #30 > > > Object id #30 is my string > >=20 > > Yes, that was a known bug in the PHP engine. It > > appeared in all PHP 5 versions from 5.0.0 to 5.1.5. > >=20 > >=20 > > > The result is similar with other object types.=20 > > > Echoing just a boolean > > > object gives [[o:Boolean]:"true"], but concatenating > > > it with a string > > > gives "Object id #1 is my boolean". > >=20 > > It should display: [[o:Boolean]:"true"] is my boolean. > >=20 > > If you don't want to upgrade to PHP 5.2.x or at least > > 5.1.6, please use the "java.so" or "php_java.dll" from > > the php-java-bridge-legacy download. It contains a > > piece of C code which works around this problem. > >=20 > >=20 > > Regards, > > Jost Boekemeier >=20 >=20 > -------------------------------------------------------------- > ----------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >=20 >=20 |