Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> [HELP] Java Object and PHP Session
In a PHP page I created an instance of a Java Object then I inserted
it in the superglobal $_Session Array:
session_start();
$frodo = new Java('Hobbit','Frodo');
$_SESSION['frodo'] = $frodo ;
the problem arise when I try to use such an object from another PHP page:
session_start();
$frodo = $_SESSION['frodo'];
$frodo->getName(); // here I have NullPointerException
I tried also using serialize\unserialize but still not working
then I tried adding a creation of a new instance to let know PHP about the class definition:
session_start();
$bilbo = new Java('Hobbit','Bilbo');
$frodo = $_SESSION['frodo'];
Here I have no error but $frodo seems to be $bilbo, as a
matter of fact i obtain "Bilbo" from the method getName and not
"Frodo" as I
expected:
$frodo->getName();
what to do ? Received on Sun Jan 11 2004 - 13:06:54 CST
![]() |
![]() |