3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ClassWithWakeup { public function __wakeup() { echo "ClassWithWakeup::__wakeup\n"; throw new Exception("exception thrown by __wakeup"); } } function __autoload($className) { echo "__autoload :: $className\n"; throw new Exception("exception thrown by __autoload"); } $params = 'a:2:{i:0;O:15:"ClassWithWakeup":0:{}i:1;O:7:"Unknown":0:{}}'; try { $result = unserialize($params); echo "try - after unserialize\n"; } catch (Exception $e) { echo "exception caught, ok\n"; }
Output for 5.4.14 - 7.1.0
ClassWithWakeup::__wakeup exception caught, ok
Output for 5.3.0 - 5.4.13
ClassWithWakeup::__wakeup __autoload :: Unknown Fatal error: Uncaught exception 'Exception' with message 'exception thrown by __wakeup' in /in/sfHcQ:5 Stack trace: #0 [internal function]: ClassWithWakeup->__wakeup() #1 /in/sfHcQ(18): unserialize('a:2:{i:0;O:15:"...') #2 {main} Next exception 'Exception' with message 'exception thrown by __autoload' in /in/sfHcQ:11 Stack trace: #0 /in/sfHcQ(0): __autoload('Unknown') #1 {main} thrown in /in/sfHcQ on line 11
Process exited with code 255.
Output for 5.0.1 - 5.2.17
ClassWithWakeup::__wakeup __autoload :: Unknown Fatal error: Function __autoload(Unknown) threw an exception of type 'Exception' in /in/sfHcQ on line 24
Process exited with code 255.
Output for 5.0.0
ClassWithWakeup::__wakeup __autoload :: Unknown Fatal error: __autoload(Unknown) threw an exception of type 'Exception' in /in/sfHcQ on line 24
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sfHcQ on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sfHcQ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/sfHcQ on line 3
Process exited with code 255.