3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.39 ms | 1400 KiB | 27 Q