3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s1 = 'O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}'; $s2 = 'O:3:"Foo":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}'; global $foo; class Foo extends DateTime { function __wakeupss() { global $foo; $foo = $this; parent::__wakeup(); } public function __set_state($a) { global $foo; $foo = $this; return; } } // Old test case try { unserialize( $s1 ); } catch ( Exception $e ) {} // My test case try { unserialize( $s2 ); } catch ( Exception $e ) {} var_dump( $foo );
Output for 5.3.0 - 5.3.17, 5.4.0 - 5.4.7
Fatal error: Cannot make static method DateTime::__set_state() non static in class Foo in /in/mq7gS on line 20
Process exited with code 255.

preferences:
169.03 ms | 1395 KiB | 33 Q