3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); $command = '/bin/bash -c "sleep 30"'; $dir = "/"; $pipes = array(); $error = $output = ""; $process = proc_open( $command, array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w') ), $pipes, $dir ); 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); sleep(1); $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 = 17, Position 2 = 49
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q5WMf
function name:  (null)
number of ops:  54
compiled vars:  !0 = $command, !1 = $dir, !2 = $pipes, !3 = $error, !4 = $output, !5 = $process, !6 = $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        ASSIGN                                                   !0, '%2Fbin%2Fbash+-c+%22sleep+30%22'
    6     4        ASSIGN                                                   !1, '%2F'
    8     5        ASSIGN                                                   !2, <array>
    9     6        ASSIGN                                           ~11     !4, ''
          7        ASSIGN                                                   !3, ~11
   11     8        INIT_FCALL                                               'proc_open'
   12     9        SEND_VAR                                                 !0
   14    10        SEND_VAL                                                 <array>
   18    11        SEND_REF                                                 !2
   19    12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $13     
   11    14        ASSIGN                                                   !5, $13
   22    15        TYPE_CHECK                                  512          !5
         16      > JMPZ                                                     ~15, ->49
   23    17    >   INIT_FCALL                                               'proc_get_status'
         18        SEND_VAR                                                 !5
         19        DO_ICALL                                         $16     
         20        ASSIGN                                                   !6, $16
   24    21        INIT_FCALL                                               'printf'
         22        SEND_VAL                                                 'running%3A+%25d+exitcode%3A+%25d%0A'
         23        FETCH_DIM_R                                      ~18     !6, 'running'
         24        SEND_VAL                                                 ~18
         25        FETCH_DIM_R                                      ~19     !6, 'exitcode'
         26        SEND_VAL                                                 ~19
         27        DO_ICALL                                                 
   25    28        ECHO                                                     'killing+proc_open%27ed+process%0A'
   26    29        INIT_FCALL                                               'posix_kill'
         30        FETCH_DIM_R                                      ~21     !6, 'pid'
         31        SEND_VAL                                                 ~21
         32        SEND_VAL                                                 9
         33        DO_ICALL                                                 
   27    34        INIT_FCALL                                               'sleep'
         35        SEND_VAL                                                 1
         36        DO_ICALL                                                 
   28    37        INIT_FCALL                                               'proc_get_status'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                         $24     
         40        ASSIGN                                                   !6, $24
   29    41        INIT_FCALL                                               'printf'
         42        SEND_VAL                                                 'running%3A+%25d+exitcode%3A+%25d%0A'
         43        FETCH_DIM_R                                      ~26     !6, 'running'
         44        SEND_VAL                                                 ~26
         45        FETCH_DIM_R                                      ~27     !6, 'exitcode'
         46        SEND_VAL                                                 ~27
         47        DO_ICALL                                                 
         48      > JMP                                                      ->53
   31    49    >   INIT_FCALL                                               'printf'
         50        SEND_VAL                                                 'proc_open+failed+for+command+%25s%0A'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                                 
   32    53    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.18 ms | 1400 KiB | 25 Q