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