3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_GET['page'] = '\'\''; if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = "home"; } $file = "templates/" . $page . ".php"; echo "strpos('$file', '..') === false"; // I heard '..' is dangerous! assert("strpos('$file', '..') === false") or die("Detected hacking attempt!"); // TODO: Make this look nice assert("file_exists('$file')") or die("That file doesn't exist!");
Output for 7.2.0 - 7.2.6
strpos('templates/''.php', '..') === false Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/815c7 on line 15 Fatal error: Uncaught ParseError: syntax error, unexpected ''.php'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in /in/815c7(15) : assert code:1 Stack trace: #0 /in/815c7(15): assert('strpos('templat...', 'assert("strpos(...') #1 {main} Next Error: Failure evaluating code: assert("strpos('$file', '..') === false"):"strpos('templates/''.php', '..') === false" in /in/815c7:15 Stack trace: #0 /in/815c7(15): assert('strpos('templat...', 'assert("strpos(...') #1 {main} thrown in /in/815c7 on line 15
Process exited with code 255.
Output for 7.1.0 - 7.1.20
strpos('templates/''.php', '..') === false Fatal error: Uncaught ParseError: syntax error, unexpected ''.php'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in /in/815c7(15) : assert code:1 Stack trace: #0 /in/815c7(15): assert('strpos('templat...', 'assert("strpos(...') #1 {main} Next Error: Failure evaluating code: assert("strpos('$file', '..') === false"):"strpos('templates/''.php', '..') === false" in /in/815c7:15 Stack trace: #0 /in/815c7(15): assert('strpos('templat...', 'assert("strpos(...') #1 {main} thrown in /in/815c7 on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.20
strpos('templates/''.php', '..') === false Parse error: syntax error, unexpected ''.php'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')' in /in/815c7(15) : assert code on line 1 Catchable fatal error: assert(): Failure evaluating code: assert("strpos('$file', '..') === false"):"strpos('templates/''.php', '..') === false" in /in/815c7 on line 15
Process exited with code 255.
Output for 5.6.0 - 5.6.26
strpos('templates/''.php', '..') === false Parse error: syntax error, unexpected ''.php'' (T_CONSTANT_ENCAPSED_STRING) in /in/815c7(15) : assert code on line 1 Catchable fatal error: assert(): Failure evaluating code: strpos('templates/''.php', '..') === false in /in/815c7 on line 15
Process exited with code 255.