Skip to content

Proposal: Dump circular references in var_export() using IIFE #14980

Open
@carlosmintfan

Description

@carlosmintfan

When having $a = array(&$a) and calling var_export($a), instead of getting

PHP Warning:  var_export does not handle circular references in php shell code on line 1
array (
  0 => NULL,
)

we could make it return an IIFE like ((function(){$a = array(&$a);return $a;})()) so we can declare that circular reference using a variable without the risk to change variables in the code where the output of var_export() will be used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions