xref: /PHP-5.3/ext/ereg/tests/ereg_error_002.phpt (revision 1881091e)
1--TEST--
2Test ereg() function : error conditions - test bad regular expressions
3--FILE--
4<?php
5/* Prototype  : proto int ereg(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 bad regular expressions
13 */
14
15echo "*** Testing ereg() : error conditions ***\n";
16
17$regs = 'original';
18
19var_dump(ereg("", "hello"));
20var_dump(ereg("c(d", "hello"));
21var_dump(ereg("a[b", "hello"));
22var_dump(ereg("c(d", "hello"));
23var_dump(ereg("*", "hello"));
24var_dump(ereg("+", "hello"));
25var_dump(ereg("?", "hello"));
26var_dump(ereg("(+?*)", "hello", $regs));
27var_dump(ereg("h{256}", "hello"));
28var_dump(ereg("h|", "hello"));
29var_dump(ereg("h{0}", "hello"));
30var_dump(ereg("h{2,1}", "hello"));
31var_dump(ereg('[a-c-e]', 'd'));
32var_dump(ereg('\\', 'x'));
33var_dump(ereg('([9-0])', '1', $regs));
34
35//ensure $regs unchanged
36var_dump($regs);
37
38echo "Done";
39?>
40--EXPECTF--
41*** Testing ereg() : error conditions ***
42
43Deprecated: Function ereg() is deprecated in %s on line %d
44
45Warning: ereg(): REG_EMPTY in %s on line %d
46bool(false)
47
48Deprecated: Function ereg() is deprecated in %s on line %d
49
50Warning: ereg(): REG_EPAREN in %s on line %d
51bool(false)
52
53Deprecated: Function ereg() is deprecated in %s on line %d
54
55Warning: ereg(): REG_EBRACK in %s on line %d
56bool(false)
57
58Deprecated: Function ereg() is deprecated in %s on line %d
59
60Warning: ereg(): REG_EPAREN in %s on line %d
61bool(false)
62
63Deprecated: Function ereg() is deprecated in %s on line %d
64
65Warning: ereg(): REG_BADRPT in %s on line %d
66bool(false)
67
68Deprecated: Function ereg() is deprecated in %s on line %d
69
70Warning: ereg(): REG_BADRPT in %s on line %d
71bool(false)
72
73Deprecated: Function ereg() is deprecated in %s on line %d
74
75Warning: ereg(): REG_BADRPT in %s on line %d
76bool(false)
77
78Deprecated: Function ereg() is deprecated in %s on line %d
79
80Warning: ereg(): REG_BADRPT in %s on line %d
81bool(false)
82
83Deprecated: Function ereg() is deprecated in %s on line %d
84
85Warning: ereg(): REG_BADBR in %s on line %d
86bool(false)
87
88Deprecated: Function ereg() is deprecated in %s on line %d
89
90Warning: ereg(): REG_EMPTY in %s on line %d
91bool(false)
92
93Deprecated: Function ereg() is deprecated in %s on line %d
94
95Warning: ereg(): REG_EMPTY in %s on line %d
96bool(false)
97
98Deprecated: Function ereg() is deprecated in %s on line %d
99
100Warning: ereg(): REG_BADBR in %s on line %d
101bool(false)
102
103Deprecated: Function ereg() is deprecated in %s on line %d
104
105Warning: ereg(): REG_ERANGE in %s on line %d
106bool(false)
107
108Deprecated: Function ereg() is deprecated in %s on line %d
109
110Warning: ereg(): REG_EESCAPE in %s on line %d
111bool(false)
112
113Deprecated: Function ereg() is deprecated in %s on line %d
114
115Warning: ereg(): REG_ERANGE in %s on line %d
116bool(false)
117string(8) "original"
118Done
119