Jochem,

On Thu, 2008-02-07 at 09:11 +0100, Jochem Maas wrote:
> Michael Moyle schreef:
> > Hi,
> > 
> > I am new to the list and have a question that inspired me to join the
> > list as I can not find any answer online.
> > 
> > When a object reference is passed to the $_SESSION array what happens to
> 
> let's assume php5. all objects are reference like, they behave from a user POV
> as objects would in php4 if you passed them by reference explicitly.
> 
> that said they're not really references - there is a Sara Golemon article 
> which
> explains it ... not that I truely understand the inner machinations of the 
> engine.
> 
Thanks. I believe the article is : 

http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html


> > the object? Is the object serialized and saved in session (in this case
> > file)? Or just the reference with the object in memory remaining on the
> > heap? 
> 
> php is 'share nothing' architecture ... everything disappears at the end of a
> request - nothing remains in memory.
> 
> an object stored in $_SESSION will be automatically serialized and saved 
> where ever
> the session data is saved (usually to disk).

That's right. That makes perfect sense. 

> 
> the only thing to remember is that you must have the class of the object 
> stored in
> $_SESSION loaded *before* you restart the session otherwise php will generate 
> an
> object of class stdClass.

Indeed. That has happened to me before.


-- 
best regards,
Michael

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

Reply via email to