FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ArrayObject - copy or reference
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ArrayObject - copy or reference [message #175171 is a reply to message #175161] Thu, 18 August 2011 17:54 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 8/18/2011 7:48 AM, Thomas Mlynarczyk wrote:
> Jo Schulze schrieb:
>
>>> $array = array( 1, 2, 3 );
>>> $obj = new ArrayObject( $array );
>>> $obj[0] = 42;
>>> echo $array[0];
>>>
>>> With PHP 5.2.0 this prints 42, with PHP 5.2.4 however, I get 1
>
>> With PHP5.3.7rc this prints 42 which I would expect.
>
> No it doesn't. I just installed PHP 5.3.7RC5 to test it. It prints 1.
>
>> The line
>> $obj[0] = 42;
>> overwites the value with hash key 0
>
> It overwrites the value with hash key 0 in *$obj*. But it should not
> modify *$array*.
>
>> I see no bug here.
>
> There has definitely been a change in behaviour somewhere between 5.2.0
> and 5.2.4. And that should be documented somewhere.
>
> Greetings,
> Thomas
>

Thomas,

I get 1 here also (php 5.2.4). I would consider this a bug - you might
want to post it to bugs.php.net.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Freelance PHP Developer
Next Topic: How to integrate paypal payment Indian currency support ..?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 03:41:55 GMT 2024

Total time taken to generate the page: 0.05087 seconds