1--TEST-- 2strrpos() offset integer overflow 3--FILE-- 4<?php 5 6try { 7 var_dump(strrpos("t", "t", PHP_INT_MAX+1)); 8} catch (TypeError $e) { 9 echo $e->getMessage(), "\n"; 10} 11 12try { 13 strrpos(1024, 1024, -PHP_INT_MAX); 14} catch (ValueError $exception) { 15 echo $exception->getMessage() . "\n"; 16} 17 18try { 19 strrpos(1024, "te", -PHP_INT_MAX); 20} catch (ValueError $exception) { 21 echo $exception->getMessage() . "\n"; 22} 23 24try { 25 strrpos(1024, 1024, -PHP_INT_MAX-1); 26} catch (ValueError $exception) { 27 echo $exception->getMessage() . "\n"; 28} 29 30try { 31 strrpos(1024, "te", -PHP_INT_MAX-1); 32} catch (ValueError $exception) { 33 echo $exception->getMessage() . "\n"; 34} 35 36echo "Done\n"; 37?> 38--EXPECT-- 39strrpos(): Argument #3 ($offset) must be of type int, float given 40strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) 41strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) 42strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) 43strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) 44Done 45