ID:               7515
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Assigned
+Status:           Critical
 Bug Type:         Scripting Engine problem
 Operating System: linux + win2k
 PHP Version:      4.0 Latest CVS (28/10/2000)
 Assigned To:      andre
 New Comment:

I have reproducted this problem... and am pretty sure what is exactly
is going wrong...
<?
class foo
{
 function foo()
 {
  $this->bar = new bar();
 }
}

class bar
{
 function bar()
 {
  $this->tmp = "bar";
 }
 function do_nothing()
 {
 }
}
$foo = new foo();
$foo->bar->tmp = "test";
$foo2 = $foo;
$foo2->bar->tmp = "foo";
var_dump($foo);
var_dump($foo2);

// now....
$foo->bar->do_nothing();
$foo3 = $foo;
$foo3->bar->tmp = "bug";
var_dump($foo);
var_dump($foo3);
?>

 Basically when you call a method from a objects member object. It
creates that member as a refrence. 

/* i set this to critical because i think this should be resloved right
away */

- Brad



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

[2002-01-11 16:11:31] [EMAIL PROTECTED]

I'm looking at putting php 4.1.1 into the next RH release 
however I noticed that this bug still seems to be happening 

(From make test)
Running tests in /usr/src/redhat/php-4.1.1//tests/lang
...
OO Bug Test (Bug #7515) (029.phpt)          ... failed

[root@dhcpd201 lang]# cat  029.exp
success
[root@dhcpd201 lang]# cat  029.out
failure

I this something that can either be fixed or can I turn a
blind eye to this..

Phil
=--=

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

[2001-12-12 08:14:56] [EMAIL PROTECTED]

Is this still a issue? This report is updated a year ago...
If this report is outstanding, PHP Version is better to be updated...

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

[2000-12-16 13:40:39] [EMAIL PROTECTED]

assigned to zeev, as discussed we either need
a) a permanent fix
b) a permanent deep copy function and understand this effect
as a feature and users will eventually have to use deep
copies for some containers

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

[2000-10-28 10:25:28] [EMAIL PROTECTED]

This code is pretty self-explanatory...

Uncommenting the noticed (*[0]) line, causes the object contained
('root') in the instance of 'obj'  to be referenced to whatever,
function test() uses a copy $o_copy but reference-counting fails and
the contained object 'root' is somehow referenced to the original
object in the global scope.
After having uncommented *[0] try to uncomment *[1] what should break
the reference again, that made me assuming this all is caused by
reference counting...

<?php
class obj {
        function method() {}
    }

function test($o_copy) {
        //$o_copy->root=&$o_copy->root; // *[1]

        $o_copy->root->set_in_copied_o=TRUE;
        var_dump($o_copy);?><BR><?php }


$o->root=new obj();
//$o->root->method();   // *[0] uncomment this line and weirdness starts

var_dump($o);?><BR><?php
test($o);
var_dump($o);
?>


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


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

Reply via email to