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