ID:               26364
 Updated by:       [EMAIL PROTECTED]
 Reported By:      brightone at o2 dot pl
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: windows xp
 PHP Version:      4.3.4
 New Comment:

Change this:
 $this->root=$root;
To:
 $this->root =& $root;

and it'll work.



Previous Comments:
------------------------------------------------------------------------

[2003-11-23 10:02:59] brightone at o2 dot pl

Description:
------------
You have two classes, one initialized in another's contructor. After
initializing the "child" class in "mother" constructor, all new values
assigned to variables in mother are not visible in pointed classes.

Reproduce code:
---------------
<? class a{
  var $temp;
  var $pointer;
  function a(){
    $this->temp=10;
    $this->pointer=new b(&$this);
    $this->temp=20;
    echo " A: ".$this->temp;
  }
}
class b{
  var $root;
  function b($root){
    $this->root=$root;
  }
  function show_val(){ 
    echo " B: ".$this->root->temp;
}
}
$r=new a;
$r->pointer->show_val();  ?>

Expected result:
----------------
A: 20 B: 20

Actual result:
--------------
A: 20 B: 10


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26364&edit=1

Reply via email to