1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 18:22:42 +01:00
Files
archived-php-src/ext/mbstring/tests/mb_strpos_offset_errors.phpt
2020-01-24 23:59:22 +01:00

57 lines
1.2 KiB
PHP

--TEST--
Offset errors for various strpos functions
--FILE--
<?php
try {
var_dump(mb_strpos("f", "bar", 3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_strpos("f", "bar", -3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_strrpos("f", "bar", 3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_strrpos("f", "bar", -3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_stripos("f", "bar", 3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_stripos("f", "bar", -3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_strripos("f", "bar", 3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(mb_strripos("f", "bar", -3));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
Offset not contained in string
Offset not contained in string
Offset not contained in string
Offset not contained in string
Offset not contained in string
Offset not contained in string
Offset not contained in string
Offset not contained in string