1--TEST--
2Test is_a() function : error conditions - wrong number of args
3--FILE--
4<?php
5/* Prototype  : proto bool is_a(object object, string class_name, bool allow_string)
6 * Description: Returns true if the object is of this class or has this class as one of its parents
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11echo "*** Testing is_a() : error conditions ***\n";
12
13//Test is_a with one more than the expected number of arguments
14echo "\n-- Testing is_a() function with more than expected no. of arguments --\n";
15$object = new stdclass();
16$class_name = 'string_val';
17$allow_string = false;
18$extra_arg = 10;
19
20var_dump( is_a($object, $class_name, $allow_string, $object) );
21
22//Test is_a with one more than the expected number of arguments
23echo "\n-- Testing is_a() function with non-boolean in last position --\n";
24var_dump( is_a($object, $class_name, $object) );
25
26
27// Testing is_a with one less than the expected number of arguments
28echo "\n-- Testing is_a() function with less than expected no. of arguments --\n";
29$object = new stdclass();
30var_dump( is_a($object) );
31
32echo "Done";
33?>
34--EXPECTF--
35*** Testing is_a() : error conditions ***
36
37-- Testing is_a() function with more than expected no. of arguments --
38
39Warning: is_a() expects at most 3 parameters, 4 given in %s on line 17
40NULL
41
42-- Testing is_a() function with non-boolean in last position --
43
44Warning: is_a() expects parameter 3 to be bool, object given in %s on line 21
45NULL
46
47-- Testing is_a() function with less than expected no. of arguments --
48
49Warning: is_a() expects at least 2 parameters, 1 given in %s on line 27
50NULL
51Done
52