1--TEST-- 2GH-16984 (function JIT overflow bug) 3--EXTENSIONS-- 4opcache 5--SKIPIF-- 6<?php if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?> 7--INI-- 8opcache.enable=1 9opcache.enable_cli=1 10opcache.file_update_protection=0 11opcache.jit_buffer_size=32M 12opcache.jit=function 13--FILE-- 14<?php 15 16final class Test { 17 public int $integer = -1; 18 19 public function foo(int $x) { 20 return $x; 21 } 22} 23 24function foo(Test $test, int $value) { 25 $val = $test->foo($value); 26 if ($val <= PHP_INT_MAX) { 27 $test->integer = $val; 28 } 29} 30 31function main() { 32 $test = new Test; 33 foo($test, 9223372036854775806); 34 foo($test, 9223372036854775807); // Also reproduces without this call, but this imitates the psalm code 35 var_dump($test->integer); 36} 37 38main(); 39?> 40--EXPECT-- 41int(9223372036854775807) 42