--TEST-- Cyclic array test --INI-- --SKIPIF-- =")) { die("skip PHP >= 8.0"); } ?> --FILE-- array( 'b' => 'c', 'd' => 'e' ), ); $a['f'] = &$a; test('array', $a, true); $a = array("foo" => &$b); $b = array(1, 2, $a); var_dump($a); var_dump($k = msgpack_unserialize(msgpack_serialize($a))); $k["foo"][1] = "b"; var_dump($k); ?> --EXPECT-- array 82a16182a162a163a164a165a16683c001a16182a162a163a164a165a16682c0020003 array(2) { ["a"]=> array(2) { ["b"]=> string(1) "c" ["d"]=> string(1) "e" } ["f"]=> &array(2) { ["a"]=> array(2) { ["b"]=> string(1) "c" ["d"]=> string(1) "e" } ["f"]=> *RECURSION* } } OK array(1) { ["foo"]=> &array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(1) { ["foo"]=> *RECURSION* } } } array(1) { ["foo"]=> &array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(1) { ["foo"]=> *RECURSION* } } } array(1) { ["foo"]=> &array(3) { [0]=> int(1) [1]=> string(1) "b" [2]=> array(1) { ["foo"]=> *RECURSION* } } }