Annotation of embedaddon/php/ext/standard/tests/general_functions/debug_zval_dump_b.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test debug_zval_dump() function : basic operations
3: --SKIPIF--
4: <?php
5: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6: ?>
7: --INI--
8: precision=14
9: --FILE--
10: <?php
11: /* Prototype: void debug_zval_dump ( mixed $variable );
12: Description: Dumps a string representation of an internal zend value
13: to output.
14: */
15:
16: /* creating file resource */
17: $file_handle = fopen(__FILE__, "r");
18:
19: echo "*** Testing debug_zval_dump() on scalar and non-scalar variables ***\n";
20: $values = array (
21: /* integers */
22: 0, // zero as argument
23: 000000123, //octal value of 83
24: 123000000,
25: -00000123, //octal value of 83
26: -12300000,
27: 0xffffff, //hexadecimal value
28: 123456789,
29: 1,
30: -1,
31:
32: /* floats */
33: -0.0,
34: +0.0,
35: 1.234,
36: -1.234,
37: -2.000000,
38: 2.0000000,
39: -4.0001e+5,
40: 4.0001E+5,
41: 6.99999989,
42: -.5,
43: .567,
44: -.6700000e-3,
45: -.6700000E+3,
46: 1E-5,
47: -1e+5,
48: 1e+5,
49: 1E-5,
50:
51: /* strings */
52: "",
53: '',
54: " ",
55: ' ',
56: "0",
57: "\0",
58: '\0',
59: "\t",
60: '\t',
61: "PHP",
62: 'PHP',
63: "1234\t\n5678\n\t9100\rabcda\x0000cdeh\0stuv", // strings with escape chars
64:
65: /* boolean */
66: TRUE,
67: FALSE,
68: true,
69: false,
70:
71: /* arrays */
72: array(),
73: array(NULL),
74: array(true),
75: array(""),
76: array(''),
77: array(array(1, 2), array('a', 'b')),
78: array("test" => "is_array", 1 => 'One'),
79: array(0),
80: array(-1),
81: array(10.5, 5.6),
82: array("string", "test"),
83: array('string', 'test'),
84:
85: /* resources */
86: $file_handle
87: );
88: /* loop to display the variables and its reference count using
89: debug_zval_dump() */
90: $counter = 1;
91: foreach( $values as $value ) {
92: echo "-- Iteration $counter --\n";
93: debug_zval_dump( $value );
94: $counter++;
95: }
96:
97: /* closing resource handle */
98: fclose($file_handle);
99:
100: echo "Done\n";
101: ?>
102: --EXPECTF--
103: *** Testing debug_zval_dump() on scalar and non-scalar variables ***
104: -- Iteration 1 --
105: long(0) refcount(3)
106: -- Iteration 2 --
107: long(83) refcount(3)
108: -- Iteration 3 --
109: long(123000000) refcount(3)
110: -- Iteration 4 --
111: long(-83) refcount(3)
112: -- Iteration 5 --
113: long(-12300000) refcount(3)
114: -- Iteration 6 --
115: long(16777215) refcount(3)
116: -- Iteration 7 --
117: long(123456789) refcount(3)
118: -- Iteration 8 --
119: long(1) refcount(3)
120: -- Iteration 9 --
121: long(-1) refcount(3)
122: -- Iteration 10 --
123: double(0) refcount(3)
124: -- Iteration 11 --
125: double(0) refcount(3)
126: -- Iteration 12 --
127: double(1.234) refcount(3)
128: -- Iteration 13 --
129: double(-1.234) refcount(3)
130: -- Iteration 14 --
131: double(-2) refcount(3)
132: -- Iteration 15 --
133: double(2) refcount(3)
134: -- Iteration 16 --
135: double(-400010) refcount(3)
136: -- Iteration 17 --
137: double(400010) refcount(3)
138: -- Iteration 18 --
139: double(6.99999989) refcount(3)
140: -- Iteration 19 --
141: double(-0.5) refcount(3)
142: -- Iteration 20 --
143: double(0.567) refcount(3)
144: -- Iteration 21 --
145: double(-0.00067) refcount(3)
146: -- Iteration 22 --
147: double(-670) refcount(3)
148: -- Iteration 23 --
149: double(1.0E-5) refcount(3)
150: -- Iteration 24 --
151: double(-100000) refcount(3)
152: -- Iteration 25 --
153: double(100000) refcount(3)
154: -- Iteration 26 --
155: double(1.0E-5) refcount(3)
156: -- Iteration 27 --
157: string(0) "" refcount(3)
158: -- Iteration 28 --
159: string(0) "" refcount(3)
160: -- Iteration 29 --
161: string(1) " " refcount(3)
162: -- Iteration 30 --
163: string(1) " " refcount(3)
164: -- Iteration 31 --
165: string(1) "0" refcount(3)
166: -- Iteration 32 --
167: string(1) "