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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Sun Dec 22 11:01:30 2024 UTC