Re: Object lifetime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux