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

1.1       misho       1: --TEST--
                      2: Test array_search() function - error conditions
                      3: --FILE--
                      4: <?php
                      5: /*
                      6:  * Prototype  : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
                      7:  * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
                      8:  * Source Code: ext/standard/array.c
                      9: */
                     10: 
                     11: echo "*** Testing error conditions of array_search() ***\n";
                     12: /* zero argument */
                     13: var_dump( array_search() );
                     14: 
                     15: /* unexpected no.of arguments in array_search() */
                     16: $var = array("mon", "tues", "wed", "thurs");
                     17: var_dump( array_search(1, $var, 0, "test") );
                     18: var_dump( array_search("test") );
                     19: 
                     20: /* unexpected second argument in array_search() */
                     21: $var="test";
                     22: var_dump( array_search("test", $var) );
                     23: var_dump( array_search(1, 123) );
                     24: 
                     25: echo "Done\n";
                     26: ?>
                     27: --EXPECTF--
                     28: *** Testing error conditions of array_search() ***
                     29: 
                     30: Warning: array_search() expects at least 2 parameters, 0 given in %s on line %d
                     31: NULL
                     32: 
                     33: Warning: array_search() expects at most 3 parameters, 4 given in %s on line %d
                     34: NULL
                     35: 
                     36: Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d
                     37: NULL
                     38: 
                     39: Warning: array_search() expects parameter 2 to be array, string given in %s on line %d
                     40: NULL
                     41: 
                     42: Warning: array_search() expects parameter 2 to be array, integer given in %s on line %d
                     43: NULL
                     44: Done

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