|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37731 internal reference becomes external
Submitted: 2006-06-07 15:55 UTC Modified: 2006-06-20 14:15 UTC
From: nhorton at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.4.2 OS: xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nhorton at gmail dot com
New email:
PHP Version: OS:


 [2006-06-07 15:55 UTC] nhorton at gmail dot com
this sure seems like a bug to me. referencing alpha to beta causes a reference to be set up between all further iterations of the object.  delta, without the reference, behaves normally.  i also tried it using foreach loops instead of for loops, same thing happened.  

Reproduce code:
class one{
     function one($i){

     $one= new one($i);

echo "<br>before loop<br>";


echo "<br>after loop<br>";

Expected result:
expected output:

before loop
one Object ( [beta] => 10 [alpha] => 10 [delta] => diamond )
after loop
one Object ( [beta] => 10 [alpha] => 10 [delta] => diamond )

Actual result:

before loop
one Object ( [beta] => 10 [alpha] => 10 [delta] => diamond )
after loop
one Object ( [beta] => xxxx [alpha] => xxxx [delta] => diamond )


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-20 14:15 UTC]
This line makes $this->aplha to point to $this->beta, i.e. they become the same variable, so changing alpha changes beta as well and vice versa.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 12:01:28 2024 UTC