xref: /PHP-5.3/ext/ereg/tests/eregi_error_001.phpt (revision 1881091e)
1--TEST--
2Test eregi() function : error conditions - wrong number of args
3--FILE--
4<?php
5/* Prototype  : proto int eregi(string pattern, string string [, array registers])
6 * Description: Regular expression match
7 * Source code: ext/standard/reg.c
8 * Alias to functions:
9 */
10
11/*
12 * Test wrong number of args
13 */
14
15echo "*** Testing eregi() : error conditions ***\n";
16
17
18//Test eregi with one more than the expected number of arguments
19echo "\n-- Testing eregi() function with more than expected no. of arguments --\n";
20$pattern = 'string_val';
21$string = 'string_val';
22$registers = array(1, 2);
23$extra_arg = 10;
24var_dump( eregi($pattern, $string, $registers, $extra_arg) );
25
26// Testing eregi with one less than the expected number of arguments
27echo "\n-- Testing eregi() function with less than expected no. of arguments --\n";
28$pattern = 'string_val';
29var_dump( eregi($pattern) );
30
31echo "Done";
32?>
33--EXPECTF--
34*** Testing eregi() : error conditions ***
35
36-- Testing eregi() function with more than expected no. of arguments --
37
38Deprecated: Function eregi() is deprecated in %s on line %d
39
40Warning: eregi() expects at most 3 parameters, 4 given in %s on line %d
41NULL
42
43-- Testing eregi() function with less than expected no. of arguments --
44
45Deprecated: Function eregi() is deprecated in %s on line %d
46
47Warning: eregi() expects at least 2 parameters, 1 given in %s on line %d
48NULL
49Done
50