1--TEST-- 2Unset from __unset respects set visibility 3--FILE-- 4<?php 5 6class C { 7 public private(set) int $a = 1; 8 public function __construct() { 9 unset($this->a); 10 } 11} 12 13class D extends C { 14 public function __unset($name) { 15 unset($this->a); 16 } 17} 18 19$c = new D(); 20try { 21 unset($c->a); 22} catch (Error $e) { 23 echo $e->getMessage(), "\n"; 24} 25var_dump($c); 26 27?> 28--EXPECTF-- 29Cannot unset private(set) property C::$a from scope D 30object(D)#%d (0) { 31 ["a"]=> 32 uninitialized(int) 33} 34