3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET['page'] = '\',\'asd\')&& phpinfo() && strpos(\'asd\', \''; 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!");
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 47) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
filename:       /in/tpdi9
function name:  (null)
number of ops:  41
compiled vars:  !0 = $page, !1 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_W                      global              $2      '_GET'
          1        ASSIGN_DIM                                               $2, 'page'
          2        OP_DATA                                                  '%27%2C%27asd%27%29%26%26+phpinfo%28%29+%26%26+strpos%28%27asd%27%2C+%27'
    5     3        FETCH_IS                                         ~4      '_GET'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          ~4, 'page'
          5      > JMPZ                                                     ~5, ->10
    6     6    >   FETCH_R                      global              ~6      '_GET'
          7        FETCH_DIM_R                                      ~7      ~6, 'page'
          8        ASSIGN                                                   !0, ~7
          9      > JMP                                                      ->11
    8    10    >   ASSIGN                                                   !0, 'home'
   11    11    >   CONCAT                                           ~10     'templates%2F', !0
         12        CONCAT                                           ~11     ~10, '.php'
         13        ASSIGN                                                   !1, ~11
   13    14        ROPE_INIT                                     3  ~14     'strpos%28%27'
         15        ROPE_ADD                                      1  ~14     ~14, !1
         16        ROPE_END                                      2  ~13     ~14, '%27%2C+%27..%27%29+%3D%3D%3D+false'
         17        ECHO                                                     ~13
   15    18        ASSERT_CHECK                                     $19     
         19        INIT_FCALL                                               'assert'
         20        ROPE_INIT                                     3  ~17     'strpos%28%27'
         21        ROPE_ADD                                      1  ~17     ~17, !1
         22        ROPE_END                                      2  ~16     ~17, '%27%2C+%27..%27%29+%3D%3D%3D+false'
         23        SEND_VAL                                                 ~16
         24        SEND_VAL                                                 'assert%28%22strpos%28%27%24file%27%2C+%27..%27%29+%3D%3D%3D+false%22%29'
         25        DO_ICALL                                         $19     
         26      > JMPNZ_EX                                         ~20     $19, ->29
         27    > > EXIT                                                     'Detected+hacking+attempt%21'
         28*       BOOL                                             ~20     <true>
   18    29    >   ASSERT_CHECK                                     $24     
         30        INIT_FCALL                                               'assert'
         31        ROPE_INIT                                     3  ~22     'file_exists%28%27'
         32        ROPE_ADD                                      1  ~22     ~22, !1
         33        ROPE_END                                      2  ~21     ~22, '%27%29'
         34        SEND_VAL                                                 ~21
         35        SEND_VAL                                                 'assert%28%22file_exists%28%27%24file%27%29%22%29'
         36        DO_ICALL                                         $24     
         37      > JMPNZ_EX                                         ~25     $24, ->40
         38    > > EXIT                                                     'That+file+doesn%27t+exist%21'
         39*       BOOL                                             ~25     <true>
         40    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.78 ms | 1411 KiB | 15 Q