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