Re: Object lifetime
| From: | Richard Lynch | Date: | Tue, 21 Feb 2006 21:48:15 +0000 |
| Subject: | Re: Object lifetime | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230834@lists.php.net to get a copy of this message | ||
On Tue, February 21, 2006 9:12 am, roger helgesen wrote:
> I'v got CLASS 1 and CLASS2.
> CLASS1 makes many instanses of CLASS2 and stores them in an array.
>
> Ex.
> ----------------------------------
> load class definition...
> start_session();
> <html>
> <form typ......
> <?PHP
> $cl1=new CLASS1;
> ----------------
> I serialize CLASS1 into a $_SESSION['cla1']
> ->submit form ->
>
> and unsreialize it to same var
> $cl1=unserialize($_SESSION['cla1']);
>
> $cl1 is operational with same data as before 'submit form'. I can
> change
> values of data in $cl1.
>
> I CAN read/print data in the instanses of CLASS2 that $cl1 created
> before 'submit form'.
> I CAN NOT change the data in the instanses of CLASS2 that $cl1 created
> before 'submit form'.
>
>
> mark I'v only serialized CLASS1.
>
> Is this at all possible ??
>
> I'v find it strange since I can use/print the data that is stored in
> CLASS2 before 'submit form'.
So...
Is the class definition for CLASS2 getting loaded in the after "submit
form" page?
Or you you expecting it to get __autoload-ed? Cuz I don't think it
will...
That might explain why you have a read-only instance.
If all else fails, you could walk the array in $cl1 and serialize each
$cl2 individually, I guess...
--
Like Music?
http://l-i-e.com/artists.htm