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