Annotation of embedaddon/php/ext/pcre/tests/preg_match_all_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test preg_match_all() function : error conditions - incorrect number of parameters
3: --FILE--
4: <?php
5: /*
6: * proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
7: * Function is implemented in ext/pcre/php_pcre.c
8: */
9: echo "*** Testing preg_match_all() : error conditions ***\n";
10: // Zero arguments
11: echo "\n-- Testing preg_match_all() function with Zero arguments --\n";
12: var_dump(preg_match_all());
13: //Test preg_match_all with one more than the expected number of arguments
14: echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n";
15: $pattern = '/\w/';
16: $subject = 'string_val';
17: $flags = PREG_OFFSET_CAPTURE;
18: $offset = 10;
19: $extra_arg = 10;
20: var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg));
21: // Testing preg_match_all withone less than the expected number of arguments
22: echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n";
23: $pattern = '/\w/';
24: $subject = 'string_val';
25: var_dump(preg_match_all($pattern, $subject));
26: echo "Done"
27: ?>
28: --EXPECTF--
29: *** Testing preg_match_all() : error conditions ***
30:
31: -- Testing preg_match_all() function with Zero arguments --
32:
33: Warning: preg_match_all() expects at least 3 parameters, 0 given in %spreg_match_all_error.php on line %d
34: bool(false)
35:
36: -- Testing preg_match_all() function with more than expected no. of arguments --
37:
38: Warning: preg_match_all() expects at most 5 parameters, 6 given in %spreg_match_all_error.php on line %d
39: bool(false)
40:
41: -- Testing preg_match_all() function with less than expected no. of arguments --
42:
43: Warning: preg_match_all() expects at least 3 parameters, 2 given in %spreg_match_all_error.php on line %d
44: bool(false)
45: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>