3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); passthru('ls -lah'); $command = 'php -r "sleep(30);"'; $pipes = array(); $error = $output = ""; $process = proc_open( $command, array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w') ), $pipes ); usleep(1000); if (is_resource($process)) { $status = proc_get_status($process); printf("running: %d exitcode: %d\n", $status['running'], $status['exitcode']); print "killing proc_open'ed process\n"; posix_kill($status['pid'], 9); $status = proc_get_status($process); printf("running: %d exitcode: %d\n", $status['running'], $status['exitcode']); } else { printf("proc_open failed for command %s\n", $command); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 50
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pTqaT
function name:  (null)
number of ops:  55
compiled vars:  !0 = $command, !1 = $pipes, !2 = $error, !3 = $output, !4 = $process, !5 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    5     3        INIT_FCALL                                               'passthru'
          4        SEND_VAL                                                 'ls+-lah'
          5        DO_ICALL                                                 
    7     6        ASSIGN                                                   !0, 'php+-r+%22sleep%2830%29%3B%22'
    9     7        ASSIGN                                                   !1, <array>
   10     8        ASSIGN                                           ~10     !3, ''
          9        ASSIGN                                                   !2, ~10
   12    10        INIT_FCALL                                               'proc_open'
   13    11        SEND_VAR                                                 !0
   15    12        SEND_VAL                                                 <array>
   19    13        SEND_REF                                                 !1
         14        DO_ICALL                                         $12     
   12    15        ASSIGN                                                   !4, $12
   21    16        INIT_FCALL                                               'usleep'
         17        SEND_VAL                                                 1000
         18        DO_ICALL                                                 
   22    19        TYPE_CHECK                                  512          !4
         20      > JMPZ                                                     ~15, ->50
   23    21    >   INIT_FCALL                                               'proc_get_status'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !5, $16
   24    25        INIT_FCALL                                               'printf'
         26        SEND_VAL                                                 'running%3A+%25d+exitcode%3A+%25d%0A'
         27        FETCH_DIM_R                                      ~18     !5, 'running'
         28        SEND_VAL                                                 ~18
         29        FETCH_DIM_R                                      ~19     !5, 'exitcode'
         30        SEND_VAL                                                 ~19
         31        DO_ICALL                                                 
   25    32        ECHO                                                     'killing+proc_open%27ed+process%0A'
   26    33        INIT_FCALL                                               'posix_kill'
         34        FETCH_DIM_R                                      ~21     !5, 'pid'
         35        SEND_VAL                                                 ~21
         36        SEND_VAL                                                 9
         37        DO_ICALL                                                 
   27    38        INIT_FCALL                                               'proc_get_status'
         39        SEND_VAR                                                 !4
         40        DO_ICALL                                         $23     
         41        ASSIGN                                                   !5, $23
   28    42        INIT_FCALL                                               'printf'
         43        SEND_VAL                                                 'running%3A+%25d+exitcode%3A+%25d%0A'
         44        FETCH_DIM_R                                      ~25     !5, 'running'
         45        SEND_VAL                                                 ~25
         46        FETCH_DIM_R                                      ~26     !5, 'exitcode'
         47        SEND_VAL                                                 ~26
         48        DO_ICALL                                                 
         49      > JMP                                                      ->54
   30    50    >   INIT_FCALL                                               'printf'
         51        SEND_VAL                                                 'proc_open+failed+for+command+%25s%0A'
         52        SEND_VAR                                                 !0
         53        DO_ICALL                                                 
   31    54    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.14 ms | 1404 KiB | 27 Q