Re: registering object in session - Object to string notice error?

From: Date: Sat, 09 Nov 2002 00:24:14 +0000
Subject: Re: registering object in session - Object to string notice error?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123520@lists.php.net to get a copy of this message
To this : session_register('somevar') and it'll work.. if your're using PHP4, you can also do this : $_SESSIONS['somevar']=$somevar Regards, P.E. Baroiller "Paul" <pax@cfl.rr.com> a écrit dans le message de news: 002601c28743$42bebbf0$6401a8c0@pawel... > > I have a simple object/class: > > Class MainData { > Var items =array(); > > ...some other functions but nothing to initialize it > } > > in a code when I do : > > $somevar= new MainData(); > session_register($somevar); > > I get "notice" type of error: > Notice: Object to string conversion in C...\page_vip.php on line 27 > > How can I avoid this? It does not stop code and it is not a fatal error > but perhaps I am missing something > > Paul > >

« previous php.general (#123520) next »