1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00
Files
archived-php-src/ext/standard/tests/strings/stripos_error.phpt
2020-06-24 13:13:44 +02:00

32 lines
831 B
PHP

--TEST--
Test stripos() function : error conditions
--FILE--
<?php
echo "*** Testing stripos() function: error conditions ***\n";
echo "\n-- Offset beyond the end of the string --\n";
try {
stripos("Hello World", "o", 12);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo "\n-- Offset before the start of the string --\n";
try {
stripos("Hello World", "o", -12);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo "*** Done ***";
?>
--EXPECT--
*** Testing stripos() function: error conditions ***
-- Offset beyond the end of the string --
stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset before the start of the string --
stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
*** Done ***