Bug #60376 [Com]: Discrepency with var_dump

From: Date: Thu, 24 Nov 2011 22:57:38 +0000
Subject: Bug #60376 [Com]: Discrepency with var_dump
References: 1  Groups: php.bugs php.qa 
Request: Send a blank email to php-bugs+get-165484@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60376&edit=1

 ID:                 60376
 Comment by:         yann-gael at gueheneuc dot net
 Reported by:        yann-gael at gueheneuc dot net
 Summary:            Discrepency with var_dump
 Status:             Wont fix
 Type:               Bug
 Package:            Testing related
 Operating System:   Windows 7 and AmigaOS v3.1
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Thank you Cataphract, I will have a look at the URL you gave. Right now, I am keen on PHP 4.2.3 only
because it has already been compiled for m68k-amigaos: I am trying to reproduce the whole
compilation tool chain before attacking the next, much more interesting challenge indeed: compiling
PHP 5 :-)


Previous Comments:
------------------------------------------------------------------------
[2011-11-24 22:15:42] cataphract@php.net

That output is indeed strange; however:

1) PHP 4.2.3 was released more than 9 years ago and is no longer supported.
2) This is not a support forum.

In any case, I'll advise to look at http://php.net/manual/en/faq.migration5.php
One of the most significant changes related to objects was that a level of indirection was added.

------------------------------------------------------------------------
[2011-11-24 20:57:26] yann-gael at gueheneuc dot net

Description:
------------
Hello,

I compiled PHP 4.2.3 for m68k-amigaos and the test case tests/lang/029.php fails. I tracked what
could be a related bug: https://bugs.php.net/bug.php?id=7515. Could someone
tell me more about what has been changed into the Zend engine to fix this earlier bug so that I can
track this change and the bug? Or could someone explain me the meaning of the "&" in
that particular case.

Code to execute:
    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 on Windows 7, 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 statement "$o->root->method();", the method is
viewed as a reference to an object?

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

Thanks,
Tygre

Test script:
---------------
    class obj {
            function method() {
            }
    }
    $o->root=new obj();
    var_dump($o);

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


Expected result:
----------------
    object(stdClass)#2 (1) {
      ["root"]=>
      object(obj)#1 (0) {
      }
    }
    object(stdClass)#2 (1) {
      ["root"]=>
      object(obj)#1 (0) {
      }
    }


Actual result:
--------------
    object(stdClass)(1) {
      ["root"]=>
      object(obj)(0) {
      }
    }
    object(stdClass)(1) {
      ["root"]=>
      &object(obj)(0) {
      }
    }



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



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


Thread (3 messages)

« previous php.bugs (#165484) next »