forked from phadej/igbinary
-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathigbinary_049.phpt
More file actions
120 lines (120 loc) · 1.8 KB
/
Copy pathigbinary_049.phpt
File metadata and controls
120 lines (120 loc) · 1.8 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
--TEST--
Correctly unserialize multiple references in arrays
--SKIPIF--
--INI--
igbinary.compact_strings = On
--FILE--
<?php
class Foo{}
$a = array("A");
$a[1] = &$a[0];
$a[2] = &$a[1];
$a[3] = &$a[2];
$a[4] = false;
$a[5] = &$a[4];
$a[6] = new Foo();
$a[7] = &$a[6];
$a[8] = &$a[7];
$a[9] = array(33);
$a[10] = new stdClass();
$a[10]->prop = &$a[8];
$a[11] = &$a[10];
$a[12] = $a[9];
$ig_ser = igbinary_serialize($a);
printf("ig_ser=%s\n", bin2hex($ig_ser));
$ig = igbinary_unserialize($ig_ser);
var_dump($ig);
$f = &$ig[3];
$f = 'V';
$g = &$ig[5];
$g = 'H';
$h = $ig[10];
$h->prop = 'S';
var_dump($ig);
--EXPECTF--
ig_ser=00000002140d0600251101410601250101060225010106032501010604250406052501020606251703466f6f1400060725220306082522030609140106000621060a251708737464436c6173731401110470726f70252203060b252205060c0104
array(13) {
[0]=>
&string(1) "A"
[1]=>
&string(1) "A"
[2]=>
&string(1) "A"
[3]=>
&string(1) "A"
[4]=>
&bool(false)
[5]=>
&bool(false)
[6]=>
&object(Foo)#%d (0) {
}
[7]=>
&object(Foo)#%d (0) {
}
[8]=>
&object(Foo)#%d (0) {
}
[9]=>
array(1) {
[0]=>
int(33)
}
[10]=>
&object(stdClass)#%d (1) {
["prop"]=>
&object(Foo)#%d (0) {
}
}
[11]=>
&object(stdClass)#%d (1) {
["prop"]=>
&object(Foo)#%d (0) {
}
}
[12]=>
array(1) {
[0]=>
int(33)
}
}
array(13) {
[0]=>
&string(1) "V"
[1]=>
&string(1) "V"
[2]=>
&string(1) "V"
[3]=>
&string(1) "V"
[4]=>
&string(1) "H"
[5]=>
&string(1) "H"
[6]=>
&string(1) "S"
[7]=>
&string(1) "S"
[8]=>
&string(1) "S"
[9]=>
array(1) {
[0]=>
int(33)
}
[10]=>
&object(stdClass)#%d (1) {
["prop"]=>
&string(1) "S"
}
[11]=>
&object(stdClass)#%d (1) {
["prop"]=>
&string(1) "S"
}
[12]=>
array(1) {
[0]=>
int(33)
}
}