3v4l.org

run code in 300+ PHP versions simultaneously
<?php // no separator $dir = '/tmp/'; ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } var_dump(file_put_contents('/tmp/hhvm-openbasedir-test', 'some data')); // with separator $dir = dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } // with separator $dir = '/tmp/'.PATH_SEPARATOR.dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 46
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 68
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
Branch analysis from position: 46
Branch analysis from position: 18
filename:       /in/MNTuo
function name:  (null)
number of ops:  69
compiled vars:  !0 = $dir, !1 = $fp, !2 = $fb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%2Ftmp%2F'
    5     1        INIT_FCALL                                               'ini_set'
          2        SEND_VAL                                                 'open_basedir'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    6     5        CONCAT                                           ~5      'ini_set+to+', !0
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
    7     8        INIT_FCALL                                               'fopen'
          9        SEND_VAL                                                 '%2Ftmp%2Fhhvm-openbasedir-test'
         10        SEND_VAL                                                 'w'
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !1, $7
    8    13      > JMPZ                                                     !1, ->18
    9    14    >   ECHO                                                     'Opened%21%0A'
   10    15        INIT_FCALL                                               'fclose'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
   12    18    >   INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'file_put_contents'
         20        SEND_VAL                                                 '%2Ftmp%2Fhhvm-openbasedir-test'
         21        SEND_VAL                                                 'some+data'
         22        DO_ICALL                                         $10     
         23        SEND_VAR                                                 $10
         24        DO_ICALL                                                 
   15    25        INIT_FCALL                                               'dirname'
         26        SEND_VAL                                                 '%2Fusr%2Fbin%2Fphp-8.0.0'
         27        DO_ICALL                                         $12     
         28        ASSIGN                                                   !0, $12
   16    29        INIT_FCALL                                               'ini_set'
         30        SEND_VAL                                                 'open_basedir'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
   17    33        CONCAT                                           ~15     'ini_set+to+', !0
         34        CONCAT                                           ~16     ~15, '%0A'
         35        ECHO                                                     ~16
   18    36        INIT_FCALL                                               'fopen'
         37        SEND_VAL                                                 '%2Ftmp%2Fhhvm-openbasedir-test'
         38        SEND_VAL                                                 'w'
         39        DO_ICALL                                         $17     
         40        ASSIGN                                                   !1, $17
   19    41      > JMPZ                                                     !1, ->46
   20    42    >   ECHO                                                     'Opened%21%0A'
   21    43        INIT_FCALL                                               'fclose'
         44        SEND_VAR                                                 !2
         45        DO_ICALL                                                 
   25    46    >   INIT_FCALL                                               'dirname'
         47        SEND_VAL                                                 '%2Fusr%2Fbin%2Fphp-8.0.0'
         48        DO_ICALL                                         $20     
         49        CONCAT                                           ~21     '%2Ftmp%2F%3A', $20
         50        ASSIGN                                                   !0, ~21
   26    51        INIT_FCALL                                               'ini_set'
         52        SEND_VAL                                                 'open_basedir'
         53        SEND_VAR                                                 !0
         54        DO_ICALL                                                 
   27    55        CONCAT                                           ~24     'ini_set+to+', !0
         56        CONCAT                                           ~25     ~24, '%0A'
         57        ECHO                                                     ~25
   28    58        INIT_FCALL                                               'fopen'
         59        SEND_VAL                                                 '%2Ftmp%2Fhhvm-openbasedir-test'
         60        SEND_VAL                                                 'w'
         61        DO_ICALL                                         $26     
         62        ASSIGN                                                   !1, $26
   29    63      > JMPZ                                                     !1, ->68
   30    64    >   ECHO                                                     'Opened%21%0A'
   31    65        INIT_FCALL                                               'fclose'
         66        SEND_VAR                                                 !2
         67        DO_ICALL                                                 
   32    68    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.3 ms | 1400 KiB | 25 Q