1--TEST-- 2Test typed properties overflowing 3--FILE-- 4<?php 5 6$foo = new class { 7 public int $bar = PHP_INT_MAX; 8}; 9 10try { 11 $foo->bar++; 12} catch(TypeError $t) { 13 var_dump($t->getMessage()); 14} 15 16var_dump($foo); 17 18try { 19 $foo->bar += 1; 20} catch(TypeError $t) { 21 var_dump($t->getMessage()); 22} 23 24var_dump($foo); 25 26try { 27 ++$foo->bar; 28} catch(TypeError $t) { 29 var_dump($t->getMessage()); 30} 31 32var_dump($foo); 33 34try { 35 $foo->bar = $foo->bar + 1; 36} catch(TypeError $t) { 37 var_dump($t->getMessage()); 38} 39 40var_dump($foo); 41?> 42--EXPECTF-- 43string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" 44object(class@anonymous)#1 (1) { 45 ["bar"]=> 46 int(%d) 47} 48string(65) "Cannot assign float to property class@anonymous::$bar of type int" 49object(class@anonymous)#1 (1) { 50 ["bar"]=> 51 int(%d) 52} 53string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" 54object(class@anonymous)#1 (1) { 55 ["bar"]=> 56 int(%d) 57} 58string(65) "Cannot assign float to property class@anonymous::$bar of type int" 59object(class@anonymous)#1 (1) { 60 ["bar"]=> 61 int(%d) 62} 63