1--TEST--
2Offset errors for various strpos functions
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7
8try {
9    var_dump(mb_strpos("f", "bar", 3));
10} catch (\ValueError $e) {
11    echo $e->getMessage() . \PHP_EOL;
12}
13try {
14    var_dump(mb_strpos("f", "bar", -3));
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18try {
19    var_dump(mb_strrpos("f", "bar", 3));
20} catch (\ValueError $e) {
21    echo $e->getMessage() . \PHP_EOL;
22}
23try {
24    var_dump(mb_strrpos("f", "bar", -3));
25} catch (\ValueError $e) {
26    echo $e->getMessage() . \PHP_EOL;
27}
28try {
29    var_dump(mb_stripos("f", "bar", 3));
30} catch (\ValueError $e) {
31    echo $e->getMessage() . \PHP_EOL;
32}
33try {
34    var_dump(mb_stripos("f", "bar", -3));
35} catch (\ValueError $e) {
36    echo $e->getMessage() . \PHP_EOL;
37}
38try {
39    var_dump(mb_strripos("f", "bar", 3));
40} catch (\ValueError $e) {
41    echo $e->getMessage() . \PHP_EOL;
42}
43try {
44    var_dump(mb_strripos("f", "bar", -3));
45} catch (\ValueError $e) {
46    echo $e->getMessage() . \PHP_EOL;
47}
48
49?>
50--EXPECT--
51mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
52mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
53mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
54mb_strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
55mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
56mb_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
57mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
58mb_strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
59