diff options
Diffstat (limited to 'ext/mbstring/tests/bug45923.phpt')
-rw-r--r-- | ext/mbstring/tests/bug45923.phpt | 80 |
1 files changed, 26 insertions, 54 deletions
diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt index eace49678c..36fdda7c00 100644 --- a/ext/mbstring/tests/bug45923.phpt +++ b/ext/mbstring/tests/bug45923.phpt @@ -7,11 +7,15 @@ Bug #45923 (mb_st[r]ripos() offset not handled correctly) function section($func, $haystack, $needle) { - echo "\n------- $func -----------\n\n"; - foreach(array(0, 3, 6, 9, 11, 12, -1, -3, -6, -20) as $offset) { - echo "> Offset: $offset\n"; - var_dump($func($haystack,$needle,$offset)); - } + echo "\n------- $func -----------\n\n"; + foreach([0, 3, 6, 9, 11, 12, -1, -3, -6, -20] as $offset) { + echo "> Offset: $offset\n"; + try { + var_dump($func($haystack, $needle, $offset)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + } } section('strpos' , "abc abc abc" , "abc"); @@ -26,7 +30,7 @@ section('mb_strrpos' , "●○◆ ●○◆ ●○◆", "●○◆"); section('strripos' , "abc abc abc" , "abc"); section('mb_strripos', "●○◆ ●○◆ ●○◆", "●○◆"); ?> ---EXPECTF-- +--EXPECT-- ------- strpos ----------- > Offset: 0 @@ -40,9 +44,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: strpos(): Offset not contained in string in %s on line %d -bool(false) +strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 bool(false) > Offset: -3 @@ -50,9 +52,7 @@ int(8) > Offset: -6 int(8) > Offset: -20 - -Warning: strpos(): Offset not contained in string in %s on line %d -bool(false) +strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- mb_strpos ----------- @@ -67,9 +67,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: mb_strpos(): Offset not contained in string in %s on line %d -bool(false) +mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 bool(false) > Offset: -3 @@ -77,9 +75,7 @@ int(8) > Offset: -6 int(8) > Offset: -20 - -Warning: mb_strpos(): Offset not contained in string in %s on line %d -bool(false) +mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- stripos ----------- @@ -94,9 +90,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: stripos(): Offset not contained in string in %s on line %d -bool(false) +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 bool(false) > Offset: -3 @@ -104,9 +98,7 @@ int(8) > Offset: -6 int(8) > Offset: -20 - -Warning: stripos(): Offset not contained in string in %s on line %d -bool(false) +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- mb_stripos ----------- @@ -121,9 +113,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: mb_stripos(): Offset not contained in string in %s on line %d -bool(false) +mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 bool(false) > Offset: -3 @@ -131,9 +121,7 @@ int(8) > Offset: -6 int(8) > Offset: -20 - -Warning: mb_stripos(): Offset not contained in string in %s on line %d -bool(false) +mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- strrpos ----------- @@ -148,9 +136,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 int(8) > Offset: -3 @@ -158,9 +144,7 @@ int(8) > Offset: -6 int(4) > Offset: -20 - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- mb_strrpos ----------- @@ -175,9 +159,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 int(8) > Offset: -3 @@ -185,9 +167,7 @@ int(8) > Offset: -6 int(4) > Offset: -20 - -Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- strripos ----------- @@ -202,9 +182,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 int(8) > Offset: -3 @@ -212,9 +190,7 @@ int(8) > Offset: -6 int(4) > Offset: -20 - -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) ------- mb_strripos ----------- @@ -229,9 +205,7 @@ bool(false) > Offset: 11 bool(false) > Offset: 12 - -Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) > Offset: -1 int(8) > Offset: -3 @@ -239,6 +213,4 @@ int(8) > Offset: -6 int(4) > Offset: -20 - -Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) +mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) |