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

1.1       misho       1: --TEST--
                      2: Test array_map() function : usage variations - failing built-in functions & language constructs
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array array_map  ( callback $callback  , array $arr1  [, array $...  ] )
                      6:  * Description: Applies the callback to the elements of the given arrays
                      7:  * Source code: ext/standard/array.c
                      8:  */
                      9: 
                     10: /*
                     11:  * Test array_map() by passing non-permmited built-in functions and language constructs i.e.
                     12:  *   echo(), array(), empty(), eval(), exit(), isset(), list(), print()
                     13:  */
                     14: 
                     15: echo "*** Testing array_map() : non-permmited built-in functions ***\n";
                     16: 
                     17: // array to be passed as arguments
                     18: $arr1 = array(1, 2);
                     19: 
                     20: // built-in functions & language constructs
                     21: $callback_names = array(
                     22: /*1*/  'echo',
                     23:        'array',
                     24:        'empty',
                     25: /*4*/  'eval',
                     26:        'exit',
                     27:        'isset',
                     28:        'list',
                     29: /*8*/  'print'
                     30: );
                     31: for($count = 0; $count < count($callback_names); $count++)
                     32: {
                     33:   echo "-- Iteration ".($count + 1)." --\n";
                     34:   var_dump( array_map($callback_names[$count], $arr1) );
                     35: }
                     36: 
                     37: echo "Done";
                     38: ?>
                     39: --EXPECTF--
                     40: *** Testing array_map() : non-permmited built-in functions ***
                     41: -- Iteration 1 --
                     42: 
                     43: Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
                     44: NULL
                     45: -- Iteration 2 --
                     46: 
                     47: Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d
                     48: NULL
                     49: -- Iteration 3 --
                     50: 
                     51: Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d
                     52: NULL
                     53: -- Iteration 4 --
                     54: 
                     55: Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d
                     56: NULL
                     57: -- Iteration 5 --
                     58: 
                     59: Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
                     60: NULL
                     61: -- Iteration 6 --
                     62: 
                     63: Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d
                     64: NULL
                     65: -- Iteration 7 --
                     66: 
                     67: Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d
                     68: NULL
                     69: -- Iteration 8 --
                     70: 
                     71: Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d
                     72: NULL
                     73: Done

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