@@ -8,13 +8,13 @@ Bug #45923 (mb_st[r]ripos() offset not handled correctly)
8
8
function section ($ func , $ haystack , $ needle )
9
9
{
10
10
echo "\n------- $ func ----------- \n\n" ;
11
- foreach (array ( 0 , 3 , 6 , 9 , 11 , 12 , -1 , -3 , -6 , -20 ) as $ offset ) {
11
+ foreach ([ 0 , 3 , 6 , 9 , 11 , 12 , -1 , -3 , -6 , -20 ] as $ offset ) {
12
12
echo "> Offset: $ offset \n" ;
13
- try {
14
- var_dump ($ func ($ haystack ,$ needle ,$ offset ));
15
- } catch (ValueError $ exception ) {
16
- echo $ exception ->getMessage () . "\n" ;
17
- }
13
+ try {
14
+ var_dump ($ func ($ haystack , $ needle , $ offset ));
15
+ } catch (\ ValueError $ e ) {
16
+ echo $ e ->getMessage () . \ PHP_EOL ;
17
+ }
18
18
}
19
19
}
20
20
@@ -30,7 +30,7 @@ section('mb_strrpos' , "●○◆ ●○◆ ●○◆", "●○◆");
30
30
section ('strripos ' , "abc abc abc " , "abc " );
31
31
section ('mb_strripos ' , "●○◆ ●○◆ ●○◆ " , "●○◆ " );
32
32
?>
33
- --EXPECTF --
33
+ --EXPECT --
34
34
------- strpos -----------
35
35
36
36
> Offset: 0
@@ -67,19 +67,15 @@ bool(false)
67
67
> Offset: 11
68
68
bool(false)
69
69
> Offset: 12
70
-
71
- Warning: mb_strpos(): Offset not contained in string in %s on line %d
72
- bool(false)
70
+ Offset not contained in string
73
71
> Offset: -1
74
72
bool(false)
75
73
> Offset: -3
76
74
int(8)
77
75
> Offset: -6
78
76
int(8)
79
77
> Offset: -20
80
-
81
- Warning: mb_strpos(): Offset not contained in string in %s on line %d
82
- bool(false)
78
+ Offset not contained in string
83
79
84
80
------- stripos -----------
85
81
@@ -117,19 +113,15 @@ bool(false)
117
113
> Offset: 11
118
114
bool(false)
119
115
> Offset: 12
120
-
121
- Warning: mb_stripos(): Offset not contained in string in %s on line %d
122
- bool(false)
116
+ Offset not contained in string
123
117
> Offset: -1
124
118
bool(false)
125
119
> Offset: -3
126
120
int(8)
127
121
> Offset: -6
128
122
int(8)
129
123
> Offset: -20
130
-
131
- Warning: mb_stripos(): Offset not contained in string in %s on line %d
132
- bool(false)
124
+ Offset not contained in string
133
125
134
126
------- strrpos -----------
135
127
@@ -167,19 +159,15 @@ bool(false)
167
159
> Offset: 11
168
160
bool(false)
169
161
> Offset: 12
170
-
171
- Warning: mb_strrpos(): Offset not contained in string in %s on line %d
172
- bool(false)
162
+ Offset not contained in string
173
163
> Offset: -1
174
164
int(8)
175
165
> Offset: -3
176
166
int(8)
177
167
> Offset: -6
178
168
int(4)
179
169
> Offset: -20
180
-
181
- Warning: mb_strrpos(): Offset not contained in string in %s on line %d
182
- bool(false)
170
+ Offset not contained in string
183
171
184
172
------- strripos -----------
185
173
@@ -217,16 +205,12 @@ bool(false)
217
205
> Offset: 11
218
206
bool(false)
219
207
> Offset: 12
220
-
221
- Warning: mb_strripos(): Offset not contained in string in %s on line %d
222
- bool(false)
208
+ Offset not contained in string
223
209
> Offset: -1
224
210
int(8)
225
211
> Offset: -3
226
212
int(8)
227
213
> Offset: -6
228
214
int(4)
229
215
> Offset: -20
230
-
231
- Warning: mb_strripos(): Offset not contained in string in %s on line %d
232
- bool(false)
216
+ Offset not contained in string
0 commit comments