3v4l.org

run code in 300+ PHP versions simultaneously
<?php class T { private $allowed = 0; function __destruct() { if ($this->allowed == 1) echo file_get_contents("key.php"); } } if ($_SERVER['REQUEST_METHOD']!="GOD") die ("Only GOD method allowed"); $headers = apache_request_headers(); $is_ajax = (isset($headers['X-Requested-With']) && $headers['X-Requested-With'] == 'XMLHttpRequest'); if(!$is_ajax) die ("This is not ajax request"); if (!isset($_COOKIE['authorize'])) die ("Cookie authorize not set."); if (!isset($_GET['data'])) die ("Parameter data not set"); $data = $_GET['data']; echo file_get_contents("index.php"); unserialize($data); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/eX2eg
function name:  (null)
number of ops:  38
compiled vars:  !0 = $headers, !1 = $is_ajax, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_R                      global              ~3      '_SERVER'
          1        FETCH_DIM_R                                      ~4      ~3, 'REQUEST_METHOD'
          2        IS_NOT_EQUAL                                             ~4, 'GOD'
          3      > JMPZ                                                     ~5, ->5
          4    > > EXIT                                                     'Only+GOD+method+allowed'
   11     5    >   INIT_FCALL_BY_NAME                                       'apache_request_headers'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !0, $6
   12     8        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !0, 'X-Requested-With'
          9      > JMPZ_EX                                          ~8      ~8, ->13
         10    >   FETCH_DIM_R                                      ~9      !0, 'X-Requested-With'
         11        IS_EQUAL                                         ~10     ~9, 'XMLHttpRequest'
         12        BOOL                                             ~8      ~10
         13    >   ASSIGN                                                   !1, ~8
   14    14        BOOL_NOT                                         ~12     !1
         15      > JMPZ                                                     ~12, ->17
         16    > > EXIT                                                     'This+is+not+ajax+request'
   15    17    >   FETCH_IS                                         ~13     '_COOKIE'
         18        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     ~13, 'authorize'
         19        BOOL_NOT                                         ~15     ~14
         20      > JMPZ                                                     ~15, ->22
         21    > > EXIT                                                     'Cookie+authorize+not+set.'
   17    22    >   FETCH_IS                                         ~16     '_GET'
         23        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     ~16, 'data'
         24        BOOL_NOT                                         ~18     ~17
         25      > JMPZ                                                     ~18, ->27
         26    > > EXIT                                                     'Parameter+data+not+set'
   19    27    >   FETCH_R                      global              ~19     '_GET'
         28        FETCH_DIM_R                                      ~20     ~19, 'data'
         29        ASSIGN                                                   !2, ~20
   21    30        INIT_FCALL                                               'file_get_contents'
         31        SEND_VAL                                                 'index.php'
         32        DO_ICALL                                         $22     
         33        ECHO                                                     $22
   23    34        INIT_FCALL                                               'unserialize'
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                                 
   25    37      > RETURN                                                   1

Class T:
Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/eX2eg
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                      ~0      'allowed'
          1        IS_EQUAL                                                 ~0, 1
          2      > JMPZ                                                     ~1, ->7
          3    >   INIT_FCALL                                               'file_get_contents'
          4        SEND_VAL                                                 'key.php'
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7    > > RETURN                                                   null

End of function __destruct

End of class T.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.34 ms | 945 KiB | 18 Q