<?php declare(strict_types=1); /* * PHP 8.0+ throw exception in error handler while proc_open executable not in path warning exit code 127 (shell/system) */ error_reporting(~0); function error_handler($code, $message, $file, $line) { fprintf(STDOUT, "error: %s ** and throw **\n", var_export(array_slice(func_get_args(), 0, 4), true)); throw new ErrorException($message, 0, $code, $file, $line); // non-catchable non-fatal exception } set_error_handler('error_handler', ~0); $pipes = []; // command must be passed as array to trigger this, string won't work. $process = proc_open(['non-existent-command'], [], $pipes); // directly produce some output fprintf(STDOUT, "open: %d\n", $process); $status = proc_get_status($process); ksort($status); fprintf(STDOUT, "status: %s\n", json_encode($status)); // let proc finish usleep(100000); $status = proc_get_status($process); ksort($status); fprintf(STDOUT, "status: %s\n", json_encode($status)); $close = proc_close($process); fprintf(STDOUT, "close: %s\n", var_export($close, true));
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`