Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> [HELP] Java Object and PHP Session

[HELP] Java Object and PHP Session

From: Roberto <akumpum_at_virgilio.it>
Date: 11 Jan 2004 11:06:54 -0800
Message-ID: <1a2604ce.0401111106.400124e0@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US