php-src/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_reference.phpt
2024-03-17 23:08:47 +00:00

42 lines
684 B
PHP

--TEST--
SPL: Test that __unserialize converts references to non-references
--FILE--
<?php
$s = new SplObjectStorage();
$y = 1;
$o = new stdClass();
$x = [$o, &$y];
$s->__unserialize([$x, []]);
var_dump($s);
$val = $s[$o];
$val = 123;
var_dump($s);
?>
--EXPECT--
object(SplObjectStorage)#1 (1) {
["storage":"SplObjectStorage":private]=>
array(1) {
[0]=>
array(2) {
["obj"]=>
object(stdClass)#2 (0) {
}
["inf"]=>
int(1)
}
}
}
object(SplObjectStorage)#1 (1) {
["storage":"SplObjectStorage":private]=>
array(1) {
[0]=>
array(2) {
["obj"]=>
object(stdClass)#2 (0) {
}
["inf"]=>
int(1)
}
}
}