php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26126 You cannot assign recursive array references.
Submitted: 2003-11-04 18:59 UTC Modified: 2014-12-30 10:41 UTC
Votes:3
Avg. Score:3.3 ± 1.7
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: bens at effortlessis dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 4.3.2 OS: All
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: bens at effortlessis dot com
New email:
PHP Version: OS:

 

 [2003-11-04 18:59 UTC] bens at effortlessis dot com
Description:
------------
It does not seem possible to reduce the following two statements into a single statement. 

<?
$in=array(1=>'a', 2=>'b', 3=>array('aa', 'bb'));
$in[3]['cc']=&$in[3]; 
?>

I would suspect that this is the same or similar issue that causes the following statement to fail:

<?
var_export($in); 
?>

Reproduce code:
---------------
<?
$in=array(1=>'a', 2=>'b', 3=>array('aa', 'bb'));
$in[3]['cc']=&$in[3]; 
var_export($in); 
?>

Expected result:
----------------
array(
 1 => 'a', 
 2 => 'b', 
 3 => array( 
  0 => 'aa', 
  1 => 'bb', 
  'cc' => &$this->3, 
  ) 
); 

/* Note: as I've said before, there doesn't seem to be a method to refer to an element within the array being created at assignment time, I've used object syntax instead */ 

Actual result:
--------------
array (
  1 => 'a',
  2 => 'b',
  3 =>
  array (
    0 => 'aa',
    1 => 'bb',
    'cc' =>
    array (
      0 => 'aa',
      1 => 'bb',
      'cc' =>
      array (
        0 => 'aa',
        1 => 'bb',
        'cc' =>
        array (

Fatal error: Nesting level too deep - recursive dependency? in /home/bens/delete on line 4


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-13 02:06 UTC] yohgaki@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues
 [2014-07-13 02:06 UTC] yohgaki@php.net
Circular reference is supported and current var_export/var_dump detect recursion. It cannot be reduced to single statement still. What kind of syntax do you suggest for it?
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 03 20:01:31 2024 UTC