@@ -8,13 +8,13 @@ Bug #45923 (mb_st[r]ripos() offset not handled correctly)
88function section ($ func , $ haystack , $ needle )
99{
1010 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 ) {
1212 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+ }
1818 }
1919}
2020
@@ -30,7 +30,7 @@ section('mb_strrpos' , "●○◆ ●○◆ ●○◆", "●○◆");
3030section ('strripos ' , "abc abc abc " , "abc " );
3131section ('mb_strripos ' , "●○◆ ●○◆ ●○◆ " , "●○◆ " );
3232?>
33- --EXPECTF --
33+ --EXPECT --
3434------- strpos -----------
3535
3636> Offset: 0
@@ -67,19 +67,15 @@ bool(false)
6767> Offset: 11
6868bool(false)
6969> 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
7371> Offset: -1
7472bool(false)
7573> Offset: -3
7674int(8)
7775> Offset: -6
7876int(8)
7977> 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
8379
8480------- stripos -----------
8581
@@ -117,19 +113,15 @@ bool(false)
117113> Offset: 11
118114bool(false)
119115> 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
123117> Offset: -1
124118bool(false)
125119> Offset: -3
126120int(8)
127121> Offset: -6
128122int(8)
129123> 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
133125
134126------- strrpos -----------
135127
@@ -167,19 +159,15 @@ bool(false)
167159> Offset: 11
168160bool(false)
169161> 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
173163> Offset: -1
174164int(8)
175165> Offset: -3
176166int(8)
177167> Offset: -6
178168int(4)
179169> 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
183171
184172------- strripos -----------
185173
@@ -217,16 +205,12 @@ bool(false)
217205> Offset: 11
218206bool(false)
219207> 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
223209> Offset: -1
224210int(8)
225211> Offset: -3
226212int(8)
227213> Offset: -6
228214int(4)
229215> 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