File: debug_zval_dump_b.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (264 lines) | stat: -rw-r--r-- 4,337 bytes parent folder | download
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
--TEST--
Test debug_zval_dump() function : basic operations
--INI--
precision=14
opcache.enable=0
--FILE--
<?php

/* creating file resource */
$file_handle = fopen(__FILE__, "r");

echo "*** Testing debug_zval_dump() on scalar and non-scalar variables ***\n";
$values = array (
  /* integers */
  0,  // zero as argument
  000000123,  //octal value of 83
  123000000,
  -00000123,  //octal value of 83
  -12300000,
  0xffffff,  //hexadecimal value
  123456789,
  1,
  -1,

  /* floats */
  -0.0,
  +0.0,
  1.234,
  -1.234,
  -2.000000,
  2.0000000,
  -4.0001e+5,
  4.0001E+5,
  6.99999989,
  -.5,
  .567,
  -.6700000e-3,
  -.6700000E+3,
  1E-5,
  -1e+5,
  1e+5,
  1E-5,

  /* strings */
  "",
  '',
  " ",
  ' ',
  "0",
  "\0",
  '\0',
  "\t",
  '\t',
  "PHP",
  'PHP',
  "1234\t\n5678\n\t9100\rabcda\x0000cdeh\0stuv",  // strings with escape chars

  /* boolean */
  TRUE,
  FALSE,
  true,
  false,

  /* arrays */
  array(),
  array(NULL),
  array(true),
  array(""),
  array(''),
  array(array(1, 2), array('a', 'b')),
  array("test" => "is_array", 1 => 'One'),
  array(0),
  array(-1),
  array(10.5, 5.6),
  array("string", "test"),
  array('string', 'test'),

  /* resources */
  $file_handle
);
/* loop to display the variables and its reference count using
    debug_zval_dump() */
$counter = 1;
foreach( $values as $value ) {
  echo "-- Iteration $counter --\n";
  debug_zval_dump( $value );
  $counter++;
}

/* closing resource handle */
fclose($file_handle);

echo "Done\n";
?>
--EXPECTF--
*** Testing debug_zval_dump() on scalar and non-scalar variables ***
-- Iteration 1 --
int(0)
-- Iteration 2 --
int(83)
-- Iteration 3 --
int(123000000)
-- Iteration 4 --
int(-83)
-- Iteration 5 --
int(-12300000)
-- Iteration 6 --
int(16777215)
-- Iteration 7 --
int(123456789)
-- Iteration 8 --
int(1)
-- Iteration 9 --
int(-1)
-- Iteration 10 --
float(-0)
-- Iteration 11 --
float(0)
-- Iteration 12 --
float(1.234)
-- Iteration 13 --
float(-1.234)
-- Iteration 14 --
float(-2)
-- Iteration 15 --
float(2)
-- Iteration 16 --
float(-400010)
-- Iteration 17 --
float(400010)
-- Iteration 18 --
float(6.99999989)
-- Iteration 19 --
float(-0.5)
-- Iteration 20 --
float(0.567)
-- Iteration 21 --
float(-0.00067)
-- Iteration 22 --
float(-670)
-- Iteration 23 --
float(1.0E-5)
-- Iteration 24 --
float(-100000)
-- Iteration 25 --
float(100000)
-- Iteration 26 --
float(1.0E-5)
-- Iteration 27 --
string(0) "" interned
-- Iteration 28 --
string(0) "" interned
-- Iteration 29 --
string(1) " " interned
-- Iteration 30 --
string(1) " " interned
-- Iteration 31 --
string(1) "0" interned
-- Iteration 32 --
string(1) "%0" interned
-- Iteration 33 --
string(2) "\0" interned
-- Iteration 34 --
string(1) "	" interned
-- Iteration 35 --
string(2) "\t" interned
-- Iteration 36 --
string(3) "PHP" interned
-- Iteration 37 --
string(3) "PHP" interned
-- Iteration 38 --
string(34) "1234	
5678
	9100
abcda%000cdeh%0stuv" interned
-- Iteration 39 --
bool(true)
-- Iteration 40 --
bool(false)
-- Iteration 41 --
bool(true)
-- Iteration 42 --
bool(false)
-- Iteration 43 --
array(0) interned {
}
-- Iteration 44 --
array(1) packed refcount(%d){
  [0]=>
  NULL
}
-- Iteration 45 --
array(1) packed refcount(%d){
  [0]=>
  bool(true)
}
-- Iteration 46 --
array(1) packed refcount(%d){
  [0]=>
  string(0) "" interned
}
-- Iteration 47 --
array(1) packed refcount(%d){
  [0]=>
  string(0) "" interned
}
-- Iteration 48 --
array(2) packed refcount(%d){
  [0]=>
  array(2) packed refcount(%d){
    [0]=>
    int(1)
    [1]=>
    int(2)
  }
  [1]=>
  array(2) packed refcount(%d){
    [0]=>
    string(1) "a" interned
    [1]=>
    string(1) "b" interned
  }
}
-- Iteration 49 --
array(2) refcount(%d){
  ["test"]=>
  string(8) "is_array" refcount(%d)
  [1]=>
  string(3) "One" refcount(%d)
}
-- Iteration 50 --
array(1) packed refcount(%d){
  [0]=>
  int(0)
}
-- Iteration 51 --
array(1) packed refcount(%d){
  [0]=>
  int(-1)
}
-- Iteration 52 --
array(2) packed refcount(%d){
  [0]=>
  float(10.5)
  [1]=>
  float(5.6)
}
-- Iteration 53 --
array(2) packed refcount(%d){
  [0]=>
  string(6) "string" refcount(%d)
  [1]=>
  string(4) "test" refcount(%d)
}
-- Iteration 54 --
array(2) packed refcount(%d){
  [0]=>
  string(6) "string" refcount(%d)
  [1]=>
  string(4) "test" refcount(%d)
}
-- Iteration 55 --
resource(%d) of type (stream) refcount(%d)
Done