Issue with the casting of a SESSION variable



Good day,

I have the a bit of an issue with retrieving an object from php's
session.

I set a session variable "user" from the class User as follows:
$user = new User();
// ... do some stuff to $user
$_SESSION['user'] = serialize($user);

And try to retrieve the variable again later:
$user=(User)unserialize($_SESSION['user']);

But the last statement throws this error:
Parse error: syntax error, unexpected T_STRING in ...

Google did not produce any useful solutions to this problem; Other
than syntax issues, but I'm 100% sure it is not an earlier syntax
issue. The problem lies in the casting of session object.

Any help would be appreciated.

Regards,
Andre
.



Relevant Pages

  • Re: Issue with the casting of a SESSION variable
    ... I have the a bit of an issue with retrieving an object from php's ... I set a session variable "user" from the class User as follows: ... than syntax issues, but I'm 100% sure it is not an earlier syntax ... The problem lies in the casting of session object. ...
    (comp.lang.php)
  • Re: [Global.asax] function Server.MapPath not available ?
    ... The only built-in objects you can use are Session and Application. ... Instead of calling the MapPath method, you can call the Context.MapPath method. ... maybe I always adopted a wrong syntax, ... but I always saw the blu irregular underline ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session object gone!
    ... Are you sure you're retrieving any data? ... If you retrive Nothing, and store ... it in Session, you will get the result you've described. ... > When I return to the calling routine my Session object is gone!! ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Local Printers Being Renamed - Big Problem!
    ... Changing the name of the redirected printer isn't possible. ... The problem lies of course in the application, ... in the session, irrespective of the name or the session id. ... When a user connects to the terminal server and connects their ...
    (microsoft.public.windows.terminal_services)
  • Idle time in a T.S. session - how to get it?
    ... allow for the idle time for a session to be retrieved. ... Terminal Services Manager is capable of retrieving & displaying this ... Is there an undocumented information class that can be used to obtain this ... Chuck Chopp ...
    (microsoft.public.win32.programmer.kernel)