1--TEST-- 2GH-7942: Disallow assigning reference to unset readonly property 3--FILE-- 4<?php 5 6class Foo { 7 public readonly int $bar; 8 public function __construct(int &$bar) { 9 $this->bar = &$bar; 10 } 11} 12 13try { 14 $i = 42; 15 new Foo($i); 16} catch (Error $e) { 17 echo $e->getMessage(), PHP_EOL; 18} 19 20?> 21--EXPECT-- 22Cannot indirectly modify readonly property Foo::$bar 23