1--TEST--
2Test debug_zval_dump() function : basic operations
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--INI--
8precision=14
9opcache.enable=0
10--FILE--
11<?php
12
13/* creating file resource */
14$file_handle = fopen(__FILE__, "r");
15
16echo "*** Testing debug_zval_dump() on scalar and non-scalar variables ***\n";
17$values = array (
18  /* integers */
19  0,  // zero as argument
20  000000123,  //octal value of 83
21  123000000,
22  -00000123,  //octal value of 83
23  -12300000,
24  0xffffff,  //hexadecimal value
25  123456789,
26  1,
27  -1,
28
29  /* floats */
30  -0.0,
31  +0.0,
32  1.234,
33  -1.234,
34  -2.000000,
35  2.0000000,
36  -4.0001e+5,
37  4.0001E+5,
38  6.99999989,
39  -.5,
40  .567,
41  -.6700000e-3,
42  -.6700000E+3,
43  1E-5,
44  -1e+5,
45  1e+5,
46  1E-5,
47
48  /* strings */
49  "",
50  '',
51  " ",
52  ' ',
53  "0",
54  "\0",
55  '\0',
56  "\t",
57  '\t',
58  "PHP",
59  'PHP',
60  "1234\t\n5678\n\t9100\rabcda\x0000cdeh\0stuv",  // strings with escape chars
61
62  /* boolean */
63  TRUE,
64  FALSE,
65  true,
66  false,
67
68  /* arrays */
69  array(),
70  array(NULL),
71  array(true),
72  array(""),
73  array(''),
74  array(array(1, 2), array('a', 'b')),
75  array("test" => "is_array", 1 => 'One'),
76  array(0),
77  array(-1),
78  array(10.5, 5.6),
79  array("string", "test"),
80  array('string', 'test'),
81
82  /* resources */
83  $file_handle
84);
85/* loop to display the variables and its reference count using
86    debug_zval_dump() */
87$counter = 1;
88foreach( $values as $value ) {
89  echo "-- Iteration $counter --\n";
90  debug_zval_dump( $value );
91  $counter++;
92}
93
94/* closing resource handle */
95fclose($file_handle);
96
97echo "Done\n";
98?>
99--EXPECTF--
100*** Testing debug_zval_dump() on scalar and non-scalar variables ***
101-- Iteration 1 --
102int(0)
103-- Iteration 2 --
104int(83)
105-- Iteration 3 --
106int(123000000)
107-- Iteration 4 --
108int(-83)
109-- Iteration 5 --
110int(-12300000)
111-- Iteration 6 --
112int(16777215)
113-- Iteration 7 --
114int(123456789)
115-- Iteration 8 --
116int(1)
117-- Iteration 9 --
118int(-1)
119-- Iteration 10 --
120float(-0)
121-- Iteration 11 --
122float(0)
123-- Iteration 12 --
124float(1.234)
125-- Iteration 13 --
126float(-1.234)
127-- Iteration 14 --
128float(-2)
129-- Iteration 15 --
130float(2)
131-- Iteration 16 --
132float(-400010)
133-- Iteration 17 --
134float(400010)
135-- Iteration 18 --
136float(6.99999989)
137-- Iteration 19 --
138float(-0.5)
139-- Iteration 20 --
140float(0.567)
141-- Iteration 21 --
142float(-0.00067)
143-- Iteration 22 --
144float(-670)
145-- Iteration 23 --
146float(1.0E-5)
147-- Iteration 24 --
148float(-100000)
149-- Iteration 25 --
150float(100000)
151-- Iteration 26 --
152float(1.0E-5)
153-- Iteration 27 --
154string(0) "" interned
155-- Iteration 28 --
156string(0) "" interned
157-- Iteration 29 --
158string(1) " " interned
159-- Iteration 30 --
160string(1) " " interned
161-- Iteration 31 --
162string(1) "0" interned
163-- Iteration 32 --
164string(1) "%0" interned
165-- Iteration 33 --
166string(2) "\0" interned
167-- Iteration 34 --
168string(1) "	" interned
169-- Iteration 35 --
170string(2) "\t" interned
171-- Iteration 36 --
172string(3) "PHP" interned
173-- Iteration 37 --
174string(3) "PHP" interned
175-- Iteration 38 --
176string(34) "1234
1775678
178	9100
178abcda%000cdeh%0stuv" interned
179-- Iteration 39 --
180bool(true)
181-- Iteration 40 --
182bool(false)
183-- Iteration 41 --
184bool(true)
185-- Iteration 42 --
186bool(false)
187-- Iteration 43 --
188array(0) interned {
189}
190-- Iteration 44 --
191array(1) packed refcount(%d){
192  [0]=>
193  NULL
194}
195-- Iteration 45 --
196array(1) packed refcount(%d){
197  [0]=>
198  bool(true)
199}
200-- Iteration 46 --
201array(1) packed refcount(%d){
202  [0]=>
203  string(0) "" interned
204}
205-- Iteration 47 --
206array(1) packed refcount(%d){
207  [0]=>
208  string(0) "" interned
209}
210-- Iteration 48 --
211array(2) packed refcount(%d){
212  [0]=>
213  array(2) packed refcount(%d){
214    [0]=>
215    int(1)
216    [1]=>
217    int(2)
218  }
219  [1]=>
220  array(2) packed refcount(%d){
221    [0]=>
222    string(1) "a" interned
223    [1]=>
224    string(1) "b" interned
225  }
226}
227-- Iteration 49 --
228array(2) refcount(%d){
229  ["test"]=>
230  string(8) "is_array" refcount(%d)
231  [1]=>
232  string(3) "One" refcount(%d)
233}
234-- Iteration 50 --
235array(1) packed refcount(%d){
236  [0]=>
237  int(0)
238}
239-- Iteration 51 --
240array(1) packed refcount(%d){
241  [0]=>
242  int(-1)
243}
244-- Iteration 52 --
245array(2) packed refcount(%d){
246  [0]=>
247  float(10.5)
248  [1]=>
249  float(5.6)
250}
251-- Iteration 53 --
252array(2) packed refcount(%d){
253  [0]=>
254  string(6) "string" refcount(%d)
255  [1]=>
256  string(4) "test" refcount(%d)
257}
258-- Iteration 54 --
259array(2) packed refcount(%d){
260  [0]=>
261  string(6) "string" refcount(%d)
262  [1]=>
263  string(4) "test" refcount(%d)
264}
265-- Iteration 55 --
266resource(%d) of type (stream) refcount(%d)
267Done
268