3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Post { protected $title; protected $text; protected $filters; function __construct($title, $text, $filters) { $this->title = $title; $this->text = $text; $this->filters = $filters; } function get_title() { return htmlspecialchars($this->title); } function display_post() { $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); return $text; } function __destruct() { // debugging stuff $s = "<!-- POST " . htmlspecialchars($this->title); $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); $s = $s . ": " . $text; $s = $s . " -->"; echo $s; } }; echo serialize(new Post("huehuehue i repor u", new SplFileObject("/home/daedalus/flag.txt", Array())));
based on MfsvA
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: SplFileObject::__construct() expects parameter 2 to be string, array given in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('/home/daedalus/...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.3.7 - 5.6.28
Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('/home/daedalus/...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.3.0 - 5.3.6
Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('????????edalus/...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.17
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?^??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.3, 5.2.7, 5.2.10, 5.2.15 - 5.2.16
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('????????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.14
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?~??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.13
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?N{?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.12
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?N??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.11
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?L??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.9
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('xZ??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.8
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?I?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.6
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?At?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.5
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('??'?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.4
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('?Ai?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.2
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct(' v??????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.1
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('??u?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.2.0
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('@J=?????T : --...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.1.3 - 5.1.6
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('#0 ????????????...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.1.2
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('<!-- POST : --...', Array) #1 {main} thrown in /in/JVrOI on line 35 *** Error in `/bin/php-5.1.2': free(): invalid next size (fast): 0x00000000023209a0 *** ======= Backtrace: ========= /usr/lib/libc.so.6(+0x72055)[0x7f0a4677f055] /usr/lib/libc.so.6(+0x779a6)[0x7f0a467849a6] /usr/lib/libc.so.6(+0x7818e)[0x7f0a4678518e] /bin/php-5.1.2(shutdown_memory_manager+0x4f)[0x67749f] /bin/php-5.1.2(php_request_shutdown+0x2f0)[0x652150] /bin/php-5.1.2(main+0x5ff)[0x45ddbf] /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f0a4672d610] /bin/php-5.1.2[0x45e7a1] ======= Memory map: ======== 00400000-00919000 r-xp 00000000 00:00 0 00919000-00b19000 ---p 00000000 00:00 0 00b19000-00bc2000 rwxp 00000000 00:00 0 00c00000-00c01000 rwxp 00000000 00:00 0 021ce000-0233e000 rwxp 00000000 00:00 0 [heap] 7f0a40000000-7f0a40021000 rwxp 00000000 00:00 0 7f0a40021000-7f0a44000000 ---p 00000000 00:00 0 7f0a45e91000-7f0a45ea7000 r-xp 00000000 00:12 41949 /usr/lib/libgcc_s.so.1 7f0a45ea7000-7f0a460a6000 ---p 00016000 00:12 41949 /usr/lib/libgcc_s.so.1 7f0a460a6000-7f0a460a7000 rwxp 00015000 00:12 41949 /usr/lib/libgcc_s.so.1 7f0a460b3000-7f0a460be000 r-xp 00000000 00:12 7582 /usr/lib/libnss_files-2.22.so 7f0a460be000-7f0a462bd000 ---p 0000b000 00:12 7582 /usr/lib/libnss_files-2.22.so 7f0a462bd000-7f0a462be000 r-xp 0000a000 00:12 7582 /usr/lib/libnss_files-2.22.so 7f0a462be000-7f0a462bf000 rwxp 0000b000 00:12 7582 /usr/lib/libnss_files-2.22.so 7f0a462bf000-7f0a462c9000 rwxp 00000000 00:00 0 7f0a462c9000-7f0a462ee000 r-xp 00000000 00:12 32324 /usr/lib/liblzma.so.5.2.2 7f0a462ee000-7f0a464ed000 ---p 00025000 00:12 32324 /usr/lib/liblzma.so.5.2.2 7f0a464ed000-7f0a464ee000 r-xp 00024000 00:12 32324 /usr/lib/liblzma.so.5.2.2 7f0a464ee000-7f0a464ef000 rwxp 00025000 00:12 32324 /usr/lib/liblzma.so.5.2.2 7f0a464ef000-7f0a46507000 r-xp 00000000 00:12 7605 /usr/lib/libpthread-2.22.so 7f0a46507000-7f0a46706000 ---p 00018000 00:12 7605 /usr/lib/libpthread-2.22.so 7f0a46706000-7f0a46707000 r-xp 00017000 00:12 7605 /usr/lib/libpthread-2.22.so 7f0a46707000-7f0a46708000 rwxp 00018000 00:12 7605 /usr/lib/libpthread-2.22.so 7f0a46708000-7f0a4670d000 rwxp 00000000 00:00 0 7f0a4670d000-7f0a468a8000 r-xp 00000000 00:12 7448 /usr/lib/libc-2.22.so 7f0a468a8000-7f0a46aa7000 ---p 0019b000 00:12 7448 /usr/lib/libc-2.22.so 7f0a46aa7000-7f0a46aab000 r-xp 0019a000 00:12 7448 /usr/lib/libc-2.22.so 7f0a46aab000-7f0a46aad000 rwxp 0019e000 00:12 7448 /usr/lib/libc-2.22.so 7f0a46aad000-7f0a46ab1000 rwxp 00000000 00:00 0 7f0a46ab1000-7f0a46c0f000 r-xp 00000000 00:12 42054 /usr/lib/libxml2.so.2.9.3 7f0a46c0f000-7f0a46e0f000 ---p 0015e000 00:12 42054 /usr/lib/libxml2.so.2.9.3 7f0a46e0f000-7f0a46e17000 r-xp 0015e000 00:12 42054 /usr/lib/libxml2.so.2.9.3 7f0a46e17000-7f0a46e19000 rwxp 00166000 00:12 42054 /usr/lib/libxml2.so.2.9.3 7f0a46e19000-7f0a46e1b000 rwxp 00000000 00:00 0 7f0a46e1b000-7f0a46e30000 r-xp 00000000 00:12 7578 /usr/lib/libnsl-2.22.so 7f0a46e30000-7f0a4702f000 ---p 00015000 00:12 7578 /usr/lib/libnsl-2.22.so 7f0a4702f000-7f0a47030000 r-xp 00014000 00:12 7578 /usr/lib/libnsl-2.22.so 7f0a47030000-7f0a47031000 rwxp 00015000 00:12 7578 /usr/lib/libnsl-2.22.so 7f0a47031000-7f0a47034000 rwxp 00000000 00:00 0 7f0a47034000-7f0a47037000 r-xp 00000000 00:12 7466 /usr/lib/libdl-2.22.so 7f0a47037000-7f0a47236000 ---p 00003000 00:12 7466 /usr/lib/libdl-2.22.so 7f0a47236000-7f0a47237000 r-xp 00002000 00:12 7466 /usr/lib/libdl-2.22.so 7f0a47237000-7f0a47238000 rwxp 00003000 00:12 7466 /usr/lib/libdl-2.22.so 7f0a47238000-7f0a47335000 r-xp 00000000 00:12 7557 /usr/lib/libm-2.22.so 7f0a47335000-7f0a47534000 ---p 000fd000 00:12 7557 /usr/lib/libm-2.22.so 7f0a47534000-7f0a47535000 r-xp 000fc000 00:12 7557 /usr/lib/libm-2.22.so 7f0a47535000-7f0a47536000 rwxp 000fd000 00:12 7557 /usr/lib/libm-2.22.so 7f0a47536000-7f0a4754a000 r-xp 00000000 00:12 7612 /usr/lib/libresolv-2.22.so 7f0a4754a000-7f0a47749000 ---p 00014000 00:12 7612 /usr/lib/libresolv-2.22.so 7f0a47749000-7f0a4774a000 r-xp 00013000 00:12 7612 /usr/lib/libresolv-2.22.so 7f0a4774a000-7f0a4774b000 rwxp 00014000 00:12 7612 /usr/lib/libresolv-2.22.so 7f0a4774b000-7f0a4774e000 rwxp 00000000 00:00 0 7f0a4774e000-7f0a47763000 r-xp 00000000 00:12 7684 /usr/lib/libz.so.1.2.8 7f0a47763000-7f0a47962000 ---p 00015000 00:12 7684 /usr/lib/libz.so.1.2.8 7f0a47962000-7f0a47963000 r-xp 00014000 00:12 7684 /usr/lib/libz.so.1.2.8 7f0a47963000-7f0a47964000 rwxp 00015000 00:12 7684 /usr/lib/libz.so.1.2.8 7f0a47964000-7f0a4796b000 r-xp 00000000 00:12 7614 /usr/lib/librt-2.22.so 7f0a4796b000-7f0a47b6a000 ---p 00007000 00:12 7614 /usr/lib/librt-2.22.so 7f0a47b6a000-7f0a47b6b000 r-xp 00006000 00:12 7614 /usr/lib/librt-2.22.so 7f0a47b6b000-7f0a47b6c000 rwxp 00007000 00:12 7614 /usr/lib/librt-2.22.so 7f0a47b6c000-7f0a47b74000 r-xp 00000000 00:12 7458 /usr/lib/libcrypt-2.22.so 7f0a47b74000-7f0a47d74000 ---p 00008000 00:12 7458 /usr/lib/libcrypt-2.22.so 7f0a47d74000-7f0a47d75000 r-xp 00008000 00:12 7458 /usr/lib/libcrypt-2.22.so 7f0a47d75000-7f0a47d76000 rwxp 00009000 00:12 7458 /usr/lib/libcrypt-2.22.so 7f0a47d76000-7f0a47da5000 rwxp 00000000 00:00 0 7f0a47db0000-7f0a47db1000 rwxp 00000000 00:00 0 7f0a47db1000-7f0a47dd3000 r-xp 00000000 00:12 7348 /usr/lib/ld-2.22.so 7f0a47dd3000-7f0a47fd2000 ---p 00000000 00:00 0 7f0a47fd2000-7f0a47fd3000 r-xp 00021000 00:12 7348 /usr/lib/ld-2.22.so 7f0a47fd3000-7f0a47fd4000 rwxp 00022000 00:12 7348 /usr/lib/ld-2.22.so 7f0a47fd4000-7f0a47fd5000 rwxp 00000000 00:00 0 7ffefafdd000-7ffefaffe000 rwxp 00000000 00:00 0 [stack] 7ffefb0b7000-7ffefb0b9000 r--p 00000000 00:00 0 [vvar] 7ffefb0b9000-7ffefb0bb000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Process exited with code 134.
Output for 5.1.0 - 5.1.1
Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : --> Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct() expects parameter 2 to be string, array given' in /in/JVrOI:35 Stack trace: #0 /in/JVrOI(35): SplFileObject->__construct('/home/daedalus/...', Array) #1 {main} thrown in /in/JVrOI on line 35
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Class 'SplFileObject' not found in /in/JVrOI on line 35 Warning: Invalid argument supplied for foreach() in /in/JVrOI on line 27 <!-- POST : -->
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/JVrOI 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/JVrOI 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/JVrOI on line 3
Process exited with code 255.