| 
	
 | 
 Posted by Justin Koivisto on 10/20/05 17:24 
Andy Jeffries wrote: 
> Justin Koivisto wrote: 
>  
>>> Just for reference (at least with PHP 4.3+) you don't need to  
>>> explicitely serialize/unserialize your objects for use in Sessions.   
>>> You can just do: 
>>> 
>>> require_once("foo.class.php"); 
>>> session_start(); 
>>> if (!is_object($_SESSION["myfoo"])) { 
>>>     $_SESSION["myfoo"] = new Foo(); 
>>> } 
>>> 
>>> $_SESSION["myfoo"]->bar(); 
>> 
>> 
>> 
>> You would not believe the number of ISPs still running the 4.0 and 4.1  
>> branches... However, it is good to point that out for those who have  
>> access to newer versions. I had that in my message, but deleted it as  
>> not to confuse the point. 
>  
>  
> I'm not sure if it actually worked in older versions, it's been a while  
> since I converted all my servers to 4.3... 
>  
> I haven't got any older versions to try it on.  Have you tried it on an  
> older version? 
 
I had done it once before and did have problems with objects in  
sessions, but I don't remember what version of PHP it was - of course,  
it could have been that server's setup as well. I've been making a point  
of not developing for versions under 4.3 as of late, and soon will be  
trying to push php5 much more. (When I've had some more time to play.) 
 
--  
Justin Koivisto, ZCE - justin@koivi.com 
http://koivi.com
 
[Back to original message] 
 |