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*** Testing is_a() : error conditions ***
38
39-- Testing is_a() function with more than expected no. of arguments --
40
41Warning: is_a() expects at most 3 parameters, 4 given in %s on line 17
42NULL
43
44-- Testing is_a() function with non-boolean in last position --
45
46Warning: is_a() expects parameter 3 to be boolean, object given in %s on line 21
47NULL
48
49-- Testing is_a() function with less than expected no. of arguments --
50
51Warning: is_a() expects at least 2 parameters, 1 given in %s on line 27
52NULL
53Done
54