3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class logger { function __construct() { print "logger constructing\n"; } function __wakeup() { print "logger wakeup\n"; } function __destruct() { print "logger destruct\n"; } } class obj { var $prop; function __wakeup() { $this->prop = 'awake'; } } $x = 'a:2:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;}'; var_dump($x); $y = unserialize($x); var_dump($y);
based on 2Yv53
Output for 7.1.10 - 7.2.0
string(87) "a:2:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;}" Notice: unserialize(): Error at offset 82 of 87 bytes in /in/qMjeO on line 23 logger wakeup logger destruct bool(false)
Output for 7.1.5 - 7.1.7
string(87) "a:2:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;}" Notice: unserialize(): Error at offset 83 of 87 bytes in /in/qMjeO on line 23 logger wakeup logger destruct bool(false)
Output for 7.1.0
string(87) "a:2:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;}" logger wakeup Notice: unserialize(): Error at offset 83 of 87 bytes in /in/qMjeO on line 23 logger destruct bool(false)
Output for 5.3.22 - 7.0.20
string(87) "a:2:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;}" logger wakeup logger destruct Notice: unserialize(): Error at offset 83 of 87 bytes in /in/qMjeO on line 23 bool(false)