1--TEST-- 2Changing Directory::$handle property 3--FILE-- 4<?php 5 6$d = dir(__DIR__); 7try { 8 $d->handle = "Havoc!"; 9} catch (\Throwable $e) { 10 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 11} 12var_dump($d->handle); 13 14try { 15 unset($d->handle); 16} catch (\Throwable $e) { 17 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 18} 19var_dump($d->handle); 20 21?> 22--EXPECTF-- 23Error: Cannot modify readonly property Directory::$handle 24resource(%d) of type (stream) 25Error: Cannot unset readonly property Directory::$handle 26resource(%d) of type (stream) 27