3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ERROR); class MyClass { function __toString() { debug_print_backtrace(); die("[!] __toString triggered!"); } } var_dump(unserialize('O:8:"DateTime":1:{s:4:"date";O:7:"MyClass":0:{}}'));
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.22, 8.4.1 - 8.4.8
Fatal error: Uncaught Error: Invalid serialization data for DateTime object in /in/JNSmm:14 Stack trace: #0 [internal function]: DateTime->__unserialize(Array) #1 /in/JNSmm(14): unserialize('O:8:"DateTime":...') #2 {main} thrown in /in/JNSmm on line 14
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.32
Fatal error: Uncaught Error: Invalid serialization data for DateTime object in /in/JNSmm:14 Stack trace: #0 [internal function]: DateTime->__wakeup() #1 /in/JNSmm(14): unserialize('O:8:"DateTime":...') #2 {main} thrown in /in/JNSmm on line 14
Process exited with code 255.
Output for 5.4.38 - 5.4.45, 5.5.22 - 5.5.38, 5.6.6 - 5.6.40, 7.0.0 - 7.0.33
Fatal error: Invalid serialization data for DateTime object in /in/JNSmm on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.37, 5.5.0 - 5.5.21, 5.6.0 - 5.6.5
#0 MyClass->__toString() #1 DateTime->__wakeup() #2 unserialize(O:8:"DateTime":1:{s:4:"date";O:7:"MyClass":0:{}}) called at [/in/JNSmm:14] [!] __toString triggered!
Output for 5.2.0 - 5.2.17
object(DateTime)#1 (1) { ["date"]=> object(MyClass)#2 (0) { } }
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
object(__PHP_Incomplete_Class)#1 (2) { ["__PHP_Incomplete_Class_Name"]=> string(8) "DateTime" ["date"]=> object(MyClass)#2 (0) { } }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
object(__PHP_Incomplete_Class)(2) { ["__PHP_Incomplete_Class_Name"]=> string(8) "datetime" ["date"]=> object(myclass)(0) { } }

preferences:
48.98 ms | 415 KiB | 5 Q