Re: Re: objects in sessions again

From: Date: Thu, 22 Apr 2004 01:32:37 +0000
Subject: Re: Re: objects in sessions again
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-184175@lists.php.net to get a copy of this message
Yes thats fine, there is a DB and auth and template class i instance globally, these are across pages aswell should i do the same ?? I dont wont to go overboard and slow the system down, I'd really want to make it scalable. These dont store any data as such though like the rest. The others i instance when i need them. Thanks !
If you don't store data in a class, then there is absolutely no reason to serialize it in a session. Serialization will *only* store property values, not methods (objects become glorified arrays). But maybe in the future this will change? A boy can dream :) Come to think of it, in PHP5 you probably *could* serialize methods in the object. But to do it you'd need to store Reflection_Method objects as properties, which just introduces a lot of other messy problems. So, um, long answer to your question: don't bother serializing those other global objects, since they don't store data.

« previous php.general (#184175) next »