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) "" refcount(3)
                    168: -- Iteration 33 --
                    169: string(2) "\0" refcount(3)
                    170: -- Iteration 34 --
                    171: string(1) "    " refcount(3)
                    172: -- Iteration 35 --
                    173: string(2) "\t" refcount(3)
                    174: -- Iteration 36 --
                    175: string(3) "PHP" refcount(3)
                    176: -- Iteration 37 --
                    177: string(3) "PHP" refcount(3)
                    178: -- Iteration 38 --
                    179: string(34) "1234       
                    180: 5678
                    181:        9100
abcda00cdehstuv" refcount(3)
                    182: -- Iteration 39 --
                    183: bool(true) refcount(3)
                    184: -- Iteration 40 --
                    185: bool(false) refcount(3)
                    186: -- Iteration 41 --
                    187: bool(true) refcount(3)
                    188: -- Iteration 42 --
                    189: bool(false) refcount(3)
                    190: -- Iteration 43 --
                    191: array(0) refcount(3){
                    192: }
                    193: -- Iteration 44 --
                    194: array(1) refcount(3){
                    195:   [0]=>
                    196:   NULL refcount(1)
                    197: }
                    198: -- Iteration 45 --
                    199: array(1) refcount(3){
                    200:   [0]=>
                    201:   bool(true) refcount(1)
                    202: }
                    203: -- Iteration 46 --
                    204: array(1) refcount(3){
                    205:   [0]=>
                    206:   string(0) "" refcount(1)
                    207: }
                    208: -- Iteration 47 --
                    209: array(1) refcount(3){
                    210:   [0]=>
                    211:   string(0) "" refcount(1)
                    212: }
                    213: -- Iteration 48 --
                    214: array(2) refcount(3){
                    215:   [0]=>
                    216:   array(2) refcount(1){
                    217:     [0]=>
                    218:     long(1) refcount(1)
                    219:     [1]=>
                    220:     long(2) refcount(1)
                    221:   }
                    222:   [1]=>
                    223:   array(2) refcount(1){
                    224:     [0]=>
                    225:     string(1) "a" refcount(1)
                    226:     [1]=>
                    227:     string(1) "b" refcount(1)
                    228:   }
                    229: }
                    230: -- Iteration 49 --
                    231: array(2) refcount(3){
                    232:   ["test"]=>
                    233:   string(8) "is_array" refcount(1)
                    234:   [1]=>
                    235:   string(3) "One" refcount(1)
                    236: }
                    237: -- Iteration 50 --
                    238: array(1) refcount(3){
                    239:   [0]=>
                    240:   long(0) refcount(1)
                    241: }
                    242: -- Iteration 51 --
                    243: array(1) refcount(3){
                    244:   [0]=>
                    245:   long(-1) refcount(1)
                    246: }
                    247: -- Iteration 52 --
                    248: array(2) refcount(3){
                    249:   [0]=>
                    250:   double(10.5) refcount(1)
                    251:   [1]=>
                    252:   double(5.6) refcount(1)
                    253: }
                    254: -- Iteration 53 --
                    255: array(2) refcount(3){
                    256:   [0]=>
                    257:   string(6) "string" refcount(1)
                    258:   [1]=>
                    259:   string(4) "test" refcount(1)
                    260: }
                    261: -- Iteration 54 --
                    262: array(2) refcount(3){
                    263:   [0]=>
                    264:   string(6) "string" refcount(1)
                    265:   [1]=>
                    266:   string(4) "test" refcount(1)
                    267: }
                    268: -- Iteration 55 --
                    269: resource(%d) of type (stream) refcount(4)
                    270: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>