1--TEST--
2strrpos() 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(strrpos("t", "t", PHP_INT_MAX+1));
9var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1));
10var_dump(strrpos(100, 101, PHP_INT_MAX+1));
11var_dump(strrpos(1024, 1024, PHP_INT_MAX+1));
12var_dump(strrpos(1024, 1024, -PHP_INT_MAX));
13var_dump(strrpos(1024, "te", -PHP_INT_MAX));
14var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1));
15var_dump(strrpos(1024, "te", -PHP_INT_MAX-1));
16
17echo "Done\n";
18?>
19--EXPECTF--
20Warning: strrpos() expects parameter 3 to be integer, float given in %s on line %d
21bool(false)
22
23Warning: strrpos() expects parameter 3 to be integer, float given in %s on line %d
24bool(false)
25
26Warning: strrpos() expects parameter 3 to be integer, float given in %s on line %d
27bool(false)
28
29Warning: strrpos() expects parameter 3 to be integer, float given in %s on line %d
30bool(false)
31
32Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
33bool(false)
34
35Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
36bool(false)
37
38Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
39bool(false)
40
41Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
42bool(false)
43Done
44