|
Posted by lister on 04/12/07 20:51
On Apr 12, 6:53 pm, "Alvaro G. Vicario"
<webmas...@NOSPAMdemogracia.com> wrote:
> *** lister escribió/wrote (12 Apr 2007 07:53:54 -0700):
>
>
>
>
>
> > $Foo = new CFoo();
> > $Foo->Bar = 5;
>
> > $_SESSION['foo'] = $Foo;
> > $_SESSION['bar'] = $Foo->Bar;
>
> > $Foo->Bar = 10;
>
> > echo $Foo->Bar;
> > echo $_SESSION['foo']->Bar;
> > echo $_SESSION['bar'];
>
> > outputs
> > 10
> > 10
> > 10
>
> In my system, this code prints:
>
> 10
> 10
> 5
>
> A wild guess... register_globals set to on?
>
> --
> -+http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
> ++ Mi sitio sobre programación web:http://bits.demogracia.com
> +- Mi web de humor con rayos UVA:http://www.demogracia.com
> --- Hide quoted text -
>
> - Show quoted text -
Many thanks for your reply, but I think I've just realised what is
going on.
Bar is actually another object in my real code, and I've just read
that all objects are references. D'oh.
I have also found the "clone" command. <slinks away>
[Back to original message]
|