1--TEST-- 2Test debug_zval_dump() function : basic operations 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); 6?> 7--INI-- 8precision=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 19echo "*** 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; 91foreach( $values as $value ) { 92 echo "-- Iteration $counter --\n"; 93 debug_zval_dump( $value ); 94 $counter++; 95} 96 97/* closing resource handle */ 98fclose($file_handle); 99 100echo "Done\n"; 101?> 102--EXPECTF-- 103*** Testing debug_zval_dump() on scalar and non-scalar variables *** 104-- Iteration 1 -- 105int(0) 106-- Iteration 2 -- 107int(83) 108-- Iteration 3 -- 109int(123000000) 110-- Iteration 4 -- 111int(-83) 112-- Iteration 5 -- 113int(-12300000) 114-- Iteration 6 -- 115int(16777215) 116-- Iteration 7 -- 117int(123456789) 118-- Iteration 8 -- 119int(1) 120-- Iteration 9 -- 121int(-1) 122-- Iteration 10 -- 123float(-0) 124-- Iteration 11 -- 125float(0) 126-- Iteration 12 -- 127float(1.234) 128-- Iteration 13 -- 129float(-1.234) 130-- Iteration 14 -- 131float(-2) 132-- Iteration 15 -- 133float(2) 134-- Iteration 16 -- 135float(-400010) 136-- Iteration 17 -- 137float(400010) 138-- Iteration 18 -- 139float(6.99999989) 140-- Iteration 19 -- 141float(-0.5) 142-- Iteration 20 -- 143float(0.567) 144-- Iteration 21 -- 145float(-0.00067) 146-- Iteration 22 -- 147float(-670) 148-- Iteration 23 -- 149float(1.0E-5) 150-- Iteration 24 -- 151float(-100000) 152-- Iteration 25 -- 153float(100000) 154-- Iteration 26 -- 155float(1.0E-5) 156-- Iteration 27 -- 157string(0) "" refcount(%d) 158-- Iteration 28 -- 159string(0) "" refcount(%d) 160-- Iteration 29 -- 161string(1) " " refcount(%d) 162-- Iteration 30 -- 163string(1) " " refcount(%d) 164-- Iteration 31 -- 165string(1) "0" refcount(%d) 166-- Iteration 32 -- 167string(1) "" refcount(%d) 168-- Iteration 33 -- 169string(2) "\0" refcount(%d) 170-- Iteration 34 -- 171string(1) " " refcount(%d) 172-- Iteration 35 -- 173string(2) "\t" refcount(%d) 174-- Iteration 36 -- 175string(3) "PHP" refcount(%d) 176-- Iteration 37 -- 177string(3) "PHP" refcount(%d) 178-- Iteration 38 -- 179string(34) "1234 1805678 181 9100 181abcda00cdehstuv" refcount(%d) 182-- Iteration 39 -- 183bool(true) 184-- Iteration 40 -- 185bool(false) 186-- Iteration 41 -- 187bool(true) 188-- Iteration 42 -- 189bool(false) 190-- Iteration 43 -- 191array(0) refcount(%d){ 192} 193-- Iteration 44 -- 194array(1) refcount(%d){ 195 [0]=> 196 NULL 197} 198-- Iteration 45 -- 199array(1) refcount(%d){ 200 [0]=> 201 bool(true) 202} 203-- Iteration 46 -- 204array(1) refcount(%d){ 205 [0]=> 206 string(0) "" refcount(%d) 207} 208-- Iteration 47 -- 209array(1) refcount(%d){ 210 [0]=> 211 string(0) "" refcount(%d) 212} 213-- Iteration 48 -- 214array(2) refcount(%d){ 215 [0]=> 216 array(2) refcount(%d){ 217 [0]=> 218 int(1) 219 [1]=> 220 int(2) 221 } 222 [1]=> 223 array(2) refcount(%d){ 224 [0]=> 225 string(1) "a" refcount(%d) 226 [1]=> 227 string(1) "b" refcount(%d) 228 } 229} 230-- Iteration 49 -- 231array(2) refcount(%d){ 232 ["test"]=> 233 string(8) "is_array" refcount(%d) 234 [1]=> 235 string(3) "One" refcount(%d) 236} 237-- Iteration 50 -- 238array(1) refcount(%d){ 239 [0]=> 240 int(0) 241} 242-- Iteration 51 -- 243array(1) refcount(%d){ 244 [0]=> 245 int(-1) 246} 247-- Iteration 52 -- 248array(2) refcount(%d){ 249 [0]=> 250 float(10.5) 251 [1]=> 252 float(5.6) 253} 254-- Iteration 53 -- 255array(2) refcount(%d){ 256 [0]=> 257 string(6) "string" refcount(%d) 258 [1]=> 259 string(4) "test" refcount(%d) 260} 261-- Iteration 54 -- 262array(2) refcount(%d){ 263 [0]=> 264 string(6) "string" refcount(%d) 265 [1]=> 266 string(4) "test" refcount(%d) 267} 268-- Iteration 55 -- 269resource(%d) of type (stream) refcount(%d) 270Done 271