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