xref: /PHP-8.2/ext/spl/tests/fixedarray_023.phpt (revision 25cb9cdb)
1--TEST--
2SPL: FixedArray: Infinite loop in var_export bugfix
3--FILE--
4<?php
5call_user_func(function () {
6    $x = new SplFixedArray(4);
7    $x[0] = NAN; // Test NAN just in case this check is incorrectly refactored to use zend_is_identical
8    $x[1] = 0.0;
9    $x[2] = $x;
10    $x[3] = $x;
11    var_export($x);
12    echo "\n";
13    $x[1] = -0.0;
14    debug_zval_dump($x);
15});
16?>
17--EXPECTF--
18Warning: var_export does not handle circular references in %s on line 8
19
20Warning: var_export does not handle circular references in %s on line 8
21\SplFixedArray::__set_state(array(
22   0 => NAN,
23   1 => 0.0,
24   2 => NULL,
25   3 => NULL,
26))
27object(SplFixedArray)#2 (4) refcount(6){
28  [0]=>
29  float(NAN)
30  [1]=>
31  float(-0)
32  [2]=>
33  *RECURSION*
34  [3]=>
35  *RECURSION*
36}