3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyClassException extends Exception { public function __construct(string $message, public string $className = '') { parent::__construct($message); } } spl_autoload_register(static function ($className) { // Do magic class file loading here. throw new MyClassException('Class not found', $className); }); try { $a = unserialize('O:10:"DummyClass":0:{}'); } catch (MyClassException $e) { $a = null; // Or some other missing class handling } var_dump($a);
Output for 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
NULL

preferences:
31.87 ms | 1136 KiB | 7 Q