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