3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $f = "now"; $arr = array("date" => &$f, "timezone_type" => 3, "timezone" => new dummyclass()); echo "before call\n"; $d = DateTime::__set_state($arr); echo "after call\n"; echo $d->format('Y-m-d H:i:s'); class dummyclass { function __toString() { global $f; echo "converting\n"; $f = 0x0c00fee0; return "Europe/Paris"; } }
Output for 7.1.0
before call Fatal error: Uncaught Error: Invalid serialization data for DateTime object in /in/KUZKi:8 Stack trace: #0 /in/KUZKi(8): DateTime::__set_state(Array) #1 {main} thrown in /in/KUZKi on line 8
Process exited with code 255.
Output for 5.4.38 - 5.4.45, 5.5.22 - 5.5.38, 5.6.6 - 7.0.14
before call Fatal error: Invalid serialization data for DateTime object in /in/KUZKi on line 8
Process exited with code 255.
Output for 5.3.0 - 5.4.37, 5.5.0 - 5.5.21, 5.6.0 - 5.6.5
before call converting
Process exited with code 139.
Output for 5.2.0 - 5.2.17
before call Fatal error: Call to undefined method DateTime::__set_state() in /in/KUZKi on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
before call Fatal error: Class 'DateTime' not found in /in/KUZKi on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.9
before call Fatal error: Undefined class name 'datetime' in /in/KUZKi on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
before call Fatal error: Undefined class name 'datetime' in /in/KUZKi on line 8