php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29390 var_dump() treats recursive references differently for objects and arrays
Submitted: 2004-07-26 17:35 UTC Modified: 2005-02-14 01:00 UTC
Votes:4
Avg. Score:2.8 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: tim at tenkan dot org Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.7 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tim at tenkan dot org
New email:
PHP Version: OS:

 

 [2004-07-26 17:35 UTC] tim at tenkan dot org
Description:
------------
var_dump() treats objects and arrays differently when they 
contain references to themselves.

Reproduce code:
---------------
<?php

class a {
}

$a = new a();
$a->foo =& $a;
var_dump($a);

$b = array();
$b[1] =& $b;
var_dump($b);


?>


Expected result:
----------------
object(a)(1) {
  ["foo"]=>
  &object(a)(1) {
    ["foo"]=>
    *RECURSION*
  }
}
array(1) {
  [1]=>
  &array(1) {
    [1]=>
    *RECURSION*
  }
}


Actual result:
--------------
object(a)(1) {
  ["foo"]=>
  &object(a)(1) {
    ["foo"]=>
    &object(a)(1) {
      ["foo"]=>
      *RECURSION*
    }
  }
}
array(1) {
  [1]=>
  array(1) {
    [1]=>
    *RECURSION*
  }
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-27 14:24 UTC] tony2001@php.net
There are some memory leaks also:
/home/tony/CVS/php-src/Zend/zend_execute.c(662) :  Freeing 0x3D17C590 (16 bytes), script=var_dump.test.php
/home/tony/CVS/php-src/Zend/zend_execute.c(3360) :  Freeing 0x3D17B9E8 (32 bytes), script=var_dump.test.php
/home/tony/CVS/php-src/Zend/zend_hash.c(169) : Actual location (location was relayed)
Last leak repeated 1 time
/home/tony/CVS/php-src/Zend/zend_execute.c(3243) :  Freeing 0x3D174CB4 (16 bytes), script=var_dump.test.php

 [2005-02-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 18:02:40 2024 UTC