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