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

 ID:                 7515
 Comment by:         yann-gael at gueheneuc dot net
 Reported by:        waldschr...@php.net
 Summary:            very weird, magic, invisible referencing
 Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   linux + win2k
 PHP Version:        4.0 Latest CVS (28/10/2000)
 Block user comment: N
 Private report:     N

 New Comment:

PS. I narrowed down the test:
    class obj {
            function method() {
            }
    }
    $o->root=new obj();
    var_dump($o);

    $o->root->method();
    var_dump($o);

and its output with PHP 4.2.3 compiled for m68k-amigaos:
    object(stdClass)(1) {
      ["root"]=>
      object(obj)(0) {
      }
    }
    object(stdClass)(1) {
      ["root"]=>
      &object(obj)(0) {
      }
    }

(note the ampersand in the second dump), while, with PHP 5.2.14 for Windows, 
the output is:
    object(stdClass)#2 (1) {
      ["root"]=>
      object(obj)#1 (0) {
      }
    }
    object(stdClass)#2 (1) {
      ["root"]=>
      object(obj)#1 (0) {
      }
    }

Does it make sense that in the second assign "$o->root->method();", the method 
is viewed as a reference to and object?

Please forgive me if my question is silly, I am a newbie in OO PHP.


Previous Comments:
------------------------------------------------------------------------
[2011-11-22 22:44:58] yann-gael at gueheneuc dot net

I compiled PHP 4.2.3 for m68k-amigaos and the test case tests/lang/029.php 
fails. Could you tell me more about what has been changed into the Zend engine 
to fix this bug so that I can track this change and the bug?

(I don't think that I should reopen this bug for m68k-amigaos, should I?)

Thanks!
Tygre

------------------------------------------------------------------------
[2002-06-03 09:33:02] mfisc...@php.net

Zend Engine 2 fixes this.

------------------------------------------------------------------------
[2002-04-11 15:28:02] rodif...@php.net

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


------------------------------------------------------------------------
[2002-01-11 16:11:31] bryce at redhat dot com

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] yohg...@php.net

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

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=7515


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

Reply via email to