Annotation of embedaddon/php/ext/standard/tests/array/array_walk_recursive_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test array_walk_recursive() function : usage variations - unexpected values in place of 'funcname' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
                      6:  * Description: Apply a user function to every member of an array 
                      7:  * Source code: ext/standard/array.c
                      8: */
                      9: 
                     10: /*
                     11:  * Passing different scalar/nonscalar values in place of 'funcname' argument
                     12: */
                     13: 
                     14: echo "*** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***\n";
                     15: 
                     16: $input = array(1, array(2, 3));
                     17: 
                     18: //get an unset variable
                     19: $unset_var = 10;
                     20: unset ($unset_var);
                     21: 
                     22: $user_data = 20;
                     23: 
                     24: // class definition
                     25: class MyClass
                     26: {
                     27:   public function __toString()
                     28:   {
                     29:     return 'object';
                     30:   }
                     31: }
                     32: 
                     33: // different scalar/nonscalar values to be used in place of callback function
                     34: $funcname_values = array(
                     35: 
                     36:          // int data
                     37: /* 1*/   0,
                     38:          1,
                     39:          12345,
                     40:          -2345,
                     41: 
                     42:          // float data
                     43: /* 5*/   10.5,
                     44:          -10.5,
                     45:          10.1234567e8,
                     46:          10.7654321E-8,
                     47:          .5,
                     48: 
                     49:          // array data
                     50: /* 10*/  array(),
                     51:          array(0),
                     52:          array(1),
                     53:          array('color' => 'red', 'item' => 'pen'),
                     54: 
                     55:          // null data
                     56: /* 14*/  NULL,
                     57:          null,
                     58: 
                     59:          // boolean data
                     60: /* 16*/  true,
                     61:          false,
                     62:          TRUE,
                     63:          FALSE,
                     64: 
                     65:          // empty data
                     66: /* 20*/  "",
                     67:          '',
                     68: 
                     69:          // object data
                     70:          new MyClass(),
                     71: 
                     72:          // resource data
                     73: /* 23*/  $fp = fopen(__FILE__, 'r'),
                     74: 
                     75:          // undefined data
                     76:          @$undefined_var,
                     77: 
                     78:          // unset data
                     79: /* 25*/  @$unset_var,
                     80: );
                     81: 
                     82: for($count = 0; $count < count($funcname_values); $count++) {
                     83:   echo "-- Iteration ".($count + 1)." --\n";
                     84:   var_dump( array_walk_recursive($input, $funcname_values[$count]) );
                     85:   var_dump( array_walk_recursive($input, $funcname_values[$count], $user_data ));
                     86: }
                     87: 
                     88: fclose($fp);
                     89: echo "Done"
                     90: ?>
                     91: --EXPECTF--
                     92: *** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***
                     93: -- Iteration 1 --
                     94: 
                     95: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                     96: NULL
                     97: 
                     98: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                     99: NULL
                    100: -- Iteration 2 --
                    101: 
                    102: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    103: NULL
                    104: 
                    105: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    106: NULL
                    107: -- Iteration 3 --
                    108: 
                    109: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    110: NULL
                    111: 
                    112: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    113: NULL
                    114: -- Iteration 4 --
                    115: 
                    116: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    117: NULL
                    118: 
                    119: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    120: NULL
                    121: -- Iteration 5 --
                    122: 
                    123: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    124: NULL
                    125: 
                    126: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    127: NULL
                    128: -- Iteration 6 --
                    129: 
                    130: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    131: NULL
                    132: 
                    133: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    134: NULL
                    135: -- Iteration 7 --
                    136: 
                    137: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    138: NULL
                    139: 
                    140: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    141: NULL
                    142: -- Iteration 8 --
                    143: 
                    144: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    145: NULL
                    146: 
                    147: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    148: NULL
                    149: -- Iteration 9 --
                    150: 
                    151: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    152: NULL
                    153: 
                    154: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    155: NULL
                    156: -- Iteration 10 --
                    157: 
                    158: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    159: NULL
                    160: 
                    161: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    162: NULL
                    163: -- Iteration 11 --
                    164: 
                    165: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    166: NULL
                    167: 
                    168: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    169: NULL
                    170: -- Iteration 12 --
                    171: 
                    172: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    173: NULL
                    174: 
                    175: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
                    176: NULL
                    177: -- Iteration 13 --
                    178: 
                    179: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d
                    180: NULL
                    181: 
                    182: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d
                    183: NULL
                    184: -- Iteration 14 --
                    185: 
                    186: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    187: NULL
                    188: 
                    189: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    190: NULL
                    191: -- Iteration 15 --
                    192: 
                    193: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    194: NULL
                    195: 
                    196: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    197: NULL
                    198: -- Iteration 16 --
                    199: 
                    200: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    201: NULL
                    202: 
                    203: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    204: NULL
                    205: -- Iteration 17 --
                    206: 
                    207: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    208: NULL
                    209: 
                    210: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    211: NULL
                    212: -- Iteration 18 --
                    213: 
                    214: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    215: NULL
                    216: 
                    217: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    218: NULL
                    219: -- Iteration 19 --
                    220: 
                    221: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    222: NULL
                    223: 
                    224: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    225: NULL
                    226: -- Iteration 20 --
                    227: 
                    228: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
                    229: NULL
                    230: 
                    231: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
                    232: NULL
                    233: -- Iteration 21 --
                    234: 
                    235: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
                    236: NULL
                    237: 
                    238: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
                    239: NULL
                    240: -- Iteration 22 --
                    241: 
                    242: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    243: NULL
                    244: 
                    245: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    246: NULL
                    247: -- Iteration 23 --
                    248: 
                    249: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    250: NULL
                    251: 
                    252: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    253: NULL
                    254: -- Iteration 24 --
                    255: 
                    256: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    257: NULL
                    258: 
                    259: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    260: NULL
                    261: -- Iteration 25 --
                    262: 
                    263: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    264: NULL
                    265: 
                    266: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
                    267: NULL
                    268: Done

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