blob: e83b9af002e24bda2635c762aa041f356f3ad767 (
plain)
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
121
122
|
--TEST--
serialize()/unserialize()/var_dump()
--INI--
serialize_precision=100
--FILE--
<?php
class t
{
function __construct()
{
$this->a = "hallo";
}
}
class s
{
public $a;
public $b;
public $c;
function __construct()
{
$this->a = "hallo";
$this->b = "php";
$this->c = "world";
$this->d = "!";
}
function __sleep()
{
echo "__sleep called\n";
return array("a","c");
}
function __wakeup()
{
echo "__wakeup called\n";
}
}
echo serialize(NULL)."\n";
echo serialize((bool) true)."\n";
echo serialize((bool) false)."\n";
echo serialize(1)."\n";
echo serialize(0)."\n";
echo serialize(-1)."\n";
echo serialize(2147483647)."\n";
echo serialize(-2147483647)."\n";
echo serialize(1.123456789)."\n";
echo serialize(1.0)."\n";
echo serialize(0.0)."\n";
echo serialize(-1.0)."\n";
echo serialize(-1.123456789)."\n";
echo serialize("hallo")."\n";
echo serialize(array(1,1.1,"hallo",NULL,true,array()))."\n";
$t = new t();
$data = serialize($t);
echo "$data\n";
$t = unserialize($data);
var_dump($t);
$t = new s();
$data = serialize($t);
echo "$data\n";
$t = unserialize($data);
var_dump($t);
$a = array("a" => "test");
$a[ "b" ] = &$a[ "a" ];
var_dump($a);
$data = serialize($a);
echo "$data\n";
$a = unserialize($data);
var_dump($a);
?>
--EXPECTF--
N;
b:1;
b:0;
i:1;
i:0;
i:-1;
i:2147483647;
i:-2147483647;
d:1.123456789000000011213842299184761941432952880859375;
d:1;
d:0;
d:-1;
d:-1.123456789000000011213842299184761941432952880859375;
s:5:"hallo";
a:6:{i:0;i:1;i:1;d:1.100000000000000088817841970012523233890533447265625;i:2;s:5:"hallo";i:3;N;i:4;b:1;i:5;a:0:{}}
O:1:"t":1:{s:1:"a";s:5:"hallo";}
object(t)#%d (1) {
["a"]=>
string(5) "hallo"
}
__sleep called
O:1:"s":2:{s:1:"a";s:5:"hallo";s:1:"c";s:5:"world";}
__wakeup called
object(s)#%d (3) {
["a"]=>
string(5) "hallo"
["b"]=>
NULL
["c"]=>
string(5) "world"
}
array(2) {
["a"]=>
&string(4) "test"
["b"]=>
&string(4) "test"
}
a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}
array(2) {
["a"]=>
&string(4) "test"
["b"]=>
&string(4) "test"
}
|