1--TEST--
2strripos() offset integer overflow
3--SKIPIF--
4<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only");
5--FILE--
6<?php
7
8var_dump(strripos("t", "t", PHP_INT_MAX+1));
9var_dump(strripos("tttt", "tt", PHP_INT_MAX+1));
10var_dump(strripos(100, 101, PHP_INT_MAX+1));
11var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
12var_dump(strripos(array(), array(), PHP_INT_MAX+1));
13var_dump(strripos(1024, 1024, -PHP_INT_MAX));
14var_dump(strripos(1024, "te", -PHP_INT_MAX));
15var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
16var_dump(strripos(1024, "te", -PHP_INT_MAX-1));
17
18echo "Done\n";
19?>
20--EXPECTF--
21Warning: strripos() expects parameter 3 to be integer, float given in %s on line %d
22bool(false)
23
24Warning: strripos() expects parameter 3 to be integer, float given in %s on line %d
25bool(false)
26
27Warning: strripos() expects parameter 3 to be integer, float given in %s on line %d
28bool(false)
29
30Warning: strripos() expects parameter 3 to be integer, float given in %s on line %d
31bool(false)
32
33Warning: strripos() expects parameter 1 to be string, array given in %s on line %d
34bool(false)
35
36Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
37bool(false)
38
39Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
40bool(false)
41
42Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
43bool(false)
44
45Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
46bool(false)
47Done
48