Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Mojavi 2.0 PHP4 Problem with object storage
January 8, 2008, 11:51 am
rate this thread
I need to store in user session an instance of an OWN class, "Foo",
Its works inside a single action but the object doesn't "survive"
between two actions (1)
Trying to access this object in the second action display :
Fatal error: Unknown(): The script tried to execute a method or access
a property of an incomplete object. Please ensure that the class
definition "Foo" of the object you are trying to operate on was loaded
_before_ the session was started
Thanks a lot for your help and ideas !
In the first action :
$foo = new Foo ();
$user->setAttribute ("foo", $foo, "my-user-namespace");
The following ... ok in the first action, but not in a second action
$newfoo = $user->getAttribute ("foo","my-user-namespace");
Re: Mojavi 2.0 PHP4 Problem with object storage
1. Be sure you have loaded the class definition before session_start(), =
NOT trust __autoload().
2. References won't survive serialisation (which is how most sessions ar=
3. Look at the manual regarding objects & serialisation (and their =
associated magic methods..)
- » Using a simple regular expressions to check a filename has '.php' on the end of it
- — Next thread in » PHP Scripting Forum