1--TEST-- 2Cannot serialize instance of Directory class constructed via Reflection. 3--FILE-- 4<?php 5 6$d = dir(__DIR__); 7try { 8 $s = serialize($d); 9 var_dump($s); 10} catch (\Throwable $e) { 11 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 12} 13 14?> 15--EXPECT-- 16Exception: Serialization of 'Directory' is not allowed 17