ID:               17239
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      4.2.1
 New Comment:

This is no longer an issue with ZE2 in which case every echo returns
'17' which is the expected behaviour.


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

[2002-05-15 05:48:47] [EMAIL PROTECTED]

There is a bug with getting copy of object where 1th object has another
2th object and 2th object has another 3th object.
When i copy 2th object to any variable i must have 2th object in 1th
and 2th object in variable. It must be equals but not 2 links to one
object.
Look at this code and make changes as recommends in conmment.

<?
class a {
        var $i;
        function a () {
                $this->i = 1;
        }
        function set_i ($p) {
                $this->i = $p;
        }
        function get_i () {
                return $this->i;
        }
}

class b {
        function b () {
                $this->a = new a ();
        }
        function set_id ($p) {
                $this->a->set_i ($p);
        }
        
        function get () {
                return $this->a->get_i ();
        }
}

class c {
        function c () {
                $this->item = new b ();
        }
}

$cat= new c();
$z1 = $cat->item;  // Comment this line
$cat->item->set_id (12);

$z = $cat->item->a;
//$z1 = $cat->item; // Decomment this line
$cat->item->set_id (17);

echo "<br>C: i: ".$cat->item->get();
echo "<br>Z: i: ".$z->get_i ();
echo "<br>Z: i: ".$z1->get ();
if ($cat->item->get() == $z1->get ()) echo " - <font color=red>Getting
BUG here. There must be '1' value!</font>";
?>


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


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

Reply via email to