Re: Objects in Arrays (without the READ prompt)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stuart Nielson wrote:
Sorry to everyone about the stupid READ notification on the posting.  I
completely forgot that it was enabled.  This one shouldn't have that
problem.


I am using PHP version 4.3.4.

I'm creating an authorization module that uses a users object, that
includes the username, usertype, etc.  I want to store this in a session
variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so
that I can keep the information from page to page.  However, I get an
error that it is an incomplete class everytime I try to access a
function from the object like this:
"$_SESSION['objects']['auth']->Login();".  It works fine when it's not
stored in the array.  Is this a PHP 4 issue?  Or is there something I'm
doing wrong?

Any pointers would be helpful. If this doesn't work, I'll have to
rework things to just store in arrays.


Stuart

Objects can't be stored in sessions, what you could do is register a shutdown function using register_shutdown_function(<functionname>) and create a custom function that would use serialize() to serialize your object.

When the system starts a new you could unserialize() this session variable back into an array.

Mathieu

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux