Hi again,
[storing a PHP object into the Java session]
> Also please see the FAQ entry "how do I create a Java object from a PHP value".
my answer wasn't quite right. Storing Java objects into the PHP session works, but not the other
way 'round. When you allocate a Java proxy backed by a PHP object the following code:
<?php
class C { var $state; function toString() {return "C:: $state";} }
echo java_session()->get("C");
java_session()->put("C", java_closure(new C()));
?>
doesn't work because the PHP state is currently *not* saved. We keep the PHP object in a global
map (see "GlobalRef.inc"), which is destroyed at the end of the script.
As a workaround please use the PHP session instead:
session_start();
$_SESSION["C"]=new C();
The PHP session can hold both, PHP and Java values. Java objects are automatically stored in the
back end. But at the moment the back end has no idea how to store/retrieve the PHP state
associated with a Java proxy.
I will add the necessary hooks in version 4.3.0. Thank you very much for reporting this issue!
Regards,
Jost Boekemeier
__________________________________
Alles was der Gesundheit und Entspannung dient. BE A BETTER MEDIZINMANN! www.yahoo.de/clever
|