Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Added new cyclic reference test
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Jan 2, 2011
1 parent 1f7b5e9 commit e8f5885
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/026b.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
--TEST--
Cyclic array test 2
--INI--
report_memleaks=0
--SKIPIF--
<?php
if(!extension_loaded('igbinary')) {
echo "skip no igbinary";
}
--FILE--
<?php

$a = array("foo" => &$b);
$b = array(1, 2, $a);
var_dump($a);

/* all three statements below should produce same output however PHP stock
* unserialize/serialize produces different output (5.2.16). I consider this is
* a PHP bug. - Oleg Grenrus
*/

//$k = $a;
//$k = unserialize(serialize($a));
$k = igbinary_unserialize(igbinary_serialize($a));
var_dump($k);

$k["foo"][1] = "b";
var_dump($k);

?>
--EXPECT--
array(1) {
["foo"]=>
&array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
*RECURSION*
}
}
array(1) {
["foo"]=>
&array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
*RECURSION*
}
}
array(1) {
["foo"]=>
&array(3) {
[0]=>
int(1)
[1]=>
string(1) "b"
[2]=>
array(1) {
["foo"]=>
*RECURSION*
}
}
}

0 comments on commit e8f5885

Please sign in to comment.