From: [EMAIL PROTECTED]
Operating system: RH 7.1
PHP version: 4.0CVS-2002-03-14
PHP Bug Type: Variables related
Bug description: CVS function var_export() can't handle recursive arrays
The problem is similar to var_dump(). var_dump() is fixed by Yasuo today
but another one raised (see Bug#16065)
var_export() has to handle recursive dependencies better and the fatal
error is not an option.
Here is the script:
<?php
$a=array();
$a[]=&$a;
var_export($a);
?>
and the ouput:
bash-2.04$ ../php export.php
X-Powered-By: PHP/4.3.0-dev
Content-type: text/html
array (
0 =>
array (
0 =>
array (
0 =>
array (
PHP Fatal error: Nesting level too deep - recursive dependency? in
/usr/samba/users/andy/412dev/php4-200203140300/te/export.php on line 4
<br />
<b>Fatal error</b>: Nesting level too deep - recursive dependency? in
<b>/usr/samba/users/andy/412dev/php4-200203140300/te/export.php</b> on
line <b>4</b><br />
Possible fix is another parameter(string) with var_export()-ed variable
name - this will fix if the array has element which is reference to the
array but will not handle this :
<?php
$a=array(1,2);
$a[]=&$a;
$b=array(&$a,3,4);
var_export($a);
?>
that crashes with output :
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 1,
1 => 2,
2 =>
array (
PHP Fatal error: Nesting level too deep - recursive dependency? in
/usr/samba/users/andy/412dev/php4-200203140300/te/export.php on line 6
<br />
<b>Fatal error</b>: Nesting level too deep - recursive dependency? in
<b>/usr/samba/users/andy/412dev/php4-200203140300/te/export.php</b> on
line <b>6</b><br />
--
Edit bug report at http://bugs.php.net/?id=16074&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16074&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16074&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16074&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16074&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16074&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16074&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16074&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16074&r=submittedtwice