3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A implements Serializable { public function unserialize($p) { echo 'uns'; } public function serialize() { return ''; } } class B { public function __wakeup() { echo 'wak';throw new Exception; } public function __destruct() { echo 'des'; } } $g[]=new B; $g[]=new A; echo serialize($g); $s='a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}'; var_dump(unserialize($s));
based on HBf0T
Output for 7.0.15 - 7.0.20, 7.1.1 - 7.3.0rc3
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}unswak Fatal error: Uncaught Exception in /in/77DE1:12 Stack trace: #0 [internal function]: B->__wakeup() #1 /in/77DE1(22): unserialize('a:2:{i:0;O:1:"B...') #2 {main} thrown in /in/77DE1 on line 12
Process exited with code 255.
Output for 7.0.10 - 7.0.14, 7.1.0
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}wak Fatal error: Uncaught Exception in /in/77DE1:12 Stack trace: #0 [internal function]: B->__wakeup() #1 /in/77DE1(22): unserialize('a:2:{i:0;O:1:"B...') #2 {main} thrown in /in/77DE1 on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.9
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}wakdes Fatal error: Uncaught Exception in /in/77DE1:12 Stack trace: #0 [internal function]: B->__wakeup() #1 /in/77DE1(22): unserialize('a:2:{i:0;O:1:"B...') #2 {main} thrown in /in/77DE1 on line 12
Process exited with code 255.
Output for hhvm-3.15.4
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}unswakdes Fatal error: Uncaught exception 'Exception' with message '' in /in/77DE1:12 Stack trace: #0 /in/77DE1(22): B->__wakeup() #1 {main} des
Process exited with code 255.
Output for 5.6.30
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}unswak Fatal error: Uncaught exception 'Exception' in /in/77DE1:12 Stack trace: #0 [internal function]: B->__wakeup() #1 /in/77DE1(22): unserialize('a:2:{i:0;O:1:"B...') #2 {main} thrown in /in/77DE1 on line 12
Process exited with code 255.
Output for 5.6.0 - 5.6.29
a:2:{i:0;O:1:"B":0:{}i:1;C:1:"A":0:{}}wakdes Fatal error: Uncaught exception 'Exception' in /in/77DE1:12 Stack trace: #0 [internal function]: B->__wakeup() #1 /in/77DE1(22): unserialize('a:2:{i:0;O:1:"B...') #2 {main} thrown in /in/77DE1 on line 12
Process exited with code 255.