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.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
NULL

preferences:
13.55 ms | 1164 KiB | 6 Q