3v4l.org

run code in 300+ PHP versions simultaneously
<?php $safe_var = 'all your base they belong to us'; file_put_contents('/tmp/exploit.txt',$safe_var ); // imagine lots of stuff going on here... $safe_var = file_get_contents('/tmp/exploit.txt'); function make_literal(string $non_literal):string { $literal = ''; for( $i = 0; $i< strlen($non_literal); $i++ ){ $literal .= chr(ord($non_literal[$i])); } return $literal; } if ( !is_noble($safe_var)) { printf( "Darn! I can't use the data I need to use.\n"); } printf( "But wait...\n"); $safe_var = make_literal($safe_var); if ( is_noble($safe_var)) { printf( "Well, since you did not provide any way to handle *legitimate* exceptions\n"); printf( "then I will just work around you, you annoying little is_literal() function!\n\n"); echo strtoupper($safe_var); echo "!!!"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 17
filename:       /in/oCBp7
function name:  (null)
number of ops:  40
compiled vars:  !0 = $safe_var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'all+your+base+they+belong+to+us'
    5     1        INIT_FCALL                                               'file_put_contents'
          2        SEND_VAL                                                 '%2Ftmp%2Fexploit.txt'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    7     5        INIT_FCALL                                               'file_get_contents'
          6        SEND_VAL                                                 '%2Ftmp%2Fexploit.txt'
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !0, $3
   17     9        INIT_FCALL_BY_NAME                                       'is_noble'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $5      
         12        BOOL_NOT                                         ~6      $5
         13      > JMPZ                                                     ~6, ->17
   18    14    >   INIT_FCALL                                               'printf'
         15        SEND_VAL                                                 'Darn%21+I+can%27t+use+the+data+I+need+to+use.%0A'
         16        DO_ICALL                                                 
   21    17    >   INIT_FCALL                                               'printf'
         18        SEND_VAL                                                 'But+wait...%0A'
         19        DO_ICALL                                                 
   22    20        INIT_FCALL                                               'make_literal'
         21        SEND_VAR                                                 !0
         22        DO_FCALL                                      0  $9      
         23        ASSIGN                                                   !0, $9
   24    24        INIT_FCALL_BY_NAME                                       'is_noble'
         25        SEND_VAR_EX                                              !0
         26        DO_FCALL                                      0  $11     
         27      > JMPZ                                                     $11, ->39
   25    28    >   INIT_FCALL                                               'printf'
         29        SEND_VAL                                                 'Well%2C+since+you+did+not+provide+any+way+to+handle+%2Alegitimate%2A+exceptions%0A'
         30        DO_ICALL                                                 
   26    31        INIT_FCALL                                               'printf'
         32        SEND_VAL                                                 'then+I+will+just+work+around+you%2C+you+annoying+little+is_literal%28%29+function%21%0A%0A'
         33        DO_ICALL                                                 
   27    34        INIT_FCALL                                               'strtoupper'
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $14     
         37        ECHO                                                     $14
   28    38        ECHO                                                     '%21%21%21'
   29    39    > > RETURN                                                   1

Function make_literal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/oCBp7
function name:  make_literal
number of ops:  20
compiled vars:  !0 = $non_literal, !1 = $literal, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN                                                   !1, ''
   11     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->13
   12     4    >   INIT_FCALL                                               'chr'
          5        INIT_FCALL                                               'ord'
          6        FETCH_DIM_R                                      ~5      !0, !2
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        ASSIGN_OP                                     8          !1, $7
   11    12        PRE_INC                                                  !2
         13    >   STRLEN                                           ~10     !0
         14        IS_SMALLER                                               !2, ~10
         15      > JMPNZ                                                    ~11, ->4
   14    16    >   VERIFY_RETURN_TYPE                                       !1
         17      > RETURN                                                   !1
   15    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function make_literal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.1 ms | 1403 KiB | 26 Q