1--TEST-- 2Attempted read/write of backing value in a delegated method throws 3--SKIPIF-- 4<?php 5if (!function_exists('zend_test_zend_call_stack_get')) die("skip zend_test_zend_call_stack_get() is not available"); 6?> 7--EXTENSIONS-- 8zend_test 9--INI-- 10; The test may use a large amount of memory on systems with a large stack limit 11memory_limit=2G 12--FILE-- 13<?php 14 15class Test { 16 public $prop = 42 { 17 get => $this->getProp($this->prop); 18 set { 19 $this->setProp($this->prop, $value); 20 } 21 } 22 23 private function getProp($prop) { 24 return $this->prop; 25 } 26 27 private function setProp($prop, $value) { 28 $this->prop = $value; 29 } 30 31 public $prop2 = 42 { 32 get => $this->prop2; 33 set => $value; 34 } 35} 36 37class Child extends Test { 38 public $prop2 = 42 { 39 get => parent::$prop2::get(); 40 set { parent::$prop2::set($value); } 41 } 42} 43 44$test = new Test; 45 46try { 47 $test->prop = 0; 48} catch (Error $e) { 49 echo $e->getMessage(), "\n"; 50} 51 52try { 53 var_dump($test->prop); 54} catch (Error $e) { 55 echo $e->getMessage(), "\n"; 56} 57 58$child = new Child(); 59$child->prop2 = 43; 60var_dump($child->prop2); 61 62?> 63--EXPECTF-- 64Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? 65Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? 66int(43) 67