File: igbinary_067.phpt

package info (click to toggle)
php-igbinary 3.2.16-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,024 kB
  • sloc: ansic: 3,373; xml: 1,106; pascal: 10; makefile: 2; php: 2; sh: 1
file content (55 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--TEST--
Test serializing multiple reference groups to the same empty array
--SKIPIF--
<?php
if (!function_exists('json_encode')) { echo "skip requires json_encode\n"; }
?>
--FILE--
<?php

function dump($array) {
	echo count($array) . " values\n";
	foreach ($array as $k => $value) {
		echo "$k: " . json_encode($value) . "\n";
	}
}

function main() {
	$a = array();
	$b = $a;
	$c = $a;
	$value = array(&$b, $a, &$b, &$c, &$c);
	$ser = igbinary_serialize($value);
	echo bin2hex($ser) . "\n";
	$v = igbinary_unserialize($ser);
	dump($v);
	$v[0][] = 2;
	dump($v);
	$v[3][] = 3;
	dump($v);
	var_export($a);
}
main();
?>
--EXPECT--
000000021405060025140006011400060225010106032514000604250103
5 values
0: []
1: []
2: []
3: []
4: []
5 values
0: [2]
1: []
2: [2]
3: []
4: []
5 values
0: [2]
1: []
2: [2]
3: [3]
4: [3]
array (
)