1--TEST--
2Test method_exists() function : error conditions - wrong number of args
3--FILE--
4<?php
5/* Prototype  : proto bool method_exists(object object, string method)
6 * Description: Checks if the class method exists
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11echo "*** Testing method_exists() : error conditions ***\n";
12
13
14//Test method_exists with one more than the expected number of arguments
15echo "\n-- Testing method_exists() function with more than expected no. of arguments --\n";
16$object = new stdclass();
17$method = 'string_val';
18$extra_arg = 10;
19var_dump( method_exists($object, $method, $extra_arg) );
20
21// Testing method_exists with one less than the expected number of arguments
22echo "\n-- Testing method_exists() function with less than expected no. of arguments --\n";
23$object = new stdclass();
24var_dump( method_exists($object) );
25
26echo "Done";
27?>
28--EXPECTF--
29*** Testing method_exists() : error conditions ***
30
31-- Testing method_exists() function with more than expected no. of arguments --
32
33Warning: method_exists() expects exactly 2 parameters, 3 given in %s on line 16
34NULL
35
36-- Testing method_exists() function with less than expected no. of arguments --
37
38Warning: method_exists() expects exactly 2 parameters, 1 given in %s on line 21
39NULL
40Done
41