fix crash caused by uninitialized zval when unserializing properties
[awesomized/ext-ion] / tests / Reader / Stream.phpt
1 --TEST--
2 ion\Reader\Stream
3 --EXTENSIONS--
4 ion
5 --FILE--
6 TEST
7 <?php
8 $s = fopen("php://memory", "r+");
9 fwrite($s, "123d0 567 890");
10 rewind($s);
11 $r = new ion\Reader\Stream\Reader($s);
12 $r->next();
13 var_dump($r->readDecimal());
14 var_dump($s === $r->getStream());
15
16 fseek($s, 2);
17 $r->resetStream($s);
18 var_dump($s === $r->getStream());
19 $r->next();
20 echo $r->getType()->name, "\n";
21 var_dump($r->readDecimal());
22
23 fseek($s, 6);
24 $r->resetStreamWithLength($s, 3);
25 var_dump($s === $r->getStream());
26 $r->next();
27 echo $r->getType()->name, "\n";
28 var_dump($r->readInt());
29
30 ?>
31 DONE
32 --EXPECTF--
33 TEST
34 object(ion\Decimal)#%d (2) {
35 ["number"]=>
36 int(123)
37 ["context"]=>
38 object(ion\Decimal\Context)#%d (5) {
39 ["digits"]=>
40 int(999999999)
41 ["eMax"]=>
42 int(999999999)
43 ["eMin"]=>
44 int(-999999999)
45 ["round"]=>
46 int(3)
47 ["clamp"]=>
48 bool(false)
49 }
50 }
51 bool(true)
52 bool(true)
53 Decimal
54 object(ion\Decimal)#%d (2) {
55 ["number"]=>
56 int(3)
57 ["context"]=>
58 object(ion\Decimal\Context)#%d (5) {
59 ["digits"]=>
60 int(999999999)
61 ["eMax"]=>
62 int(999999999)
63 ["eMin"]=>
64 int(-999999999)
65 ["round"]=>
66 int(3)
67 ["clamp"]=>
68 bool(false)
69 }
70 }
71 bool(true)
72 Int
73 int(567)
74 DONE