1--TEST-- 2Memory leaks on wrong assignment to typed property 3--FILE-- 4<?php 5class Foo { 6 public int $bbb; 7} 8 9function foo() { 10 return new Foo(); 11} 12 13function bar() { 14 return str_repeat("b", 3); 15} 16 17for ($i = 0; $i < 5; $i++) { 18 try { 19 foo()->{bar()} = str_repeat("a", 3); 20 } catch (Throwable $e) { 21 echo $e->getMessage() . "\n"; 22 } 23} 24?> 25--EXPECT-- 26Cannot assign string to property Foo::$bbb of type int 27Cannot assign string to property Foo::$bbb of type int 28Cannot assign string to property Foo::$bbb of type int 29Cannot assign string to property Foo::$bbb of type int 30Cannot assign string to property Foo::$bbb of type int 31