The shell_exec() function is used to execute an external program and grab its entire output as a string, but it lacks a way to capture the exit code of the launched program contrarily to all the other functions of the same family (exec, system, passthru).
This RFC proposes the addition of a second, optional parameter $result_code to the shell_exec() function:
function shell_exec(string $command, &$result_code = null): string|false|null {}
If $result_code is present, the function will put the return code of the program into it. The same parameter and behaviour is found in exec(), system() and passthru() functions.
No backward compatibility breaks.
Next PHP 8.x, currently PHP 8.2.
None.
None.
None.
No new constants introduced.
No new php.ini options introduced.
Yes/No vote, super majority of 2/3 required to pass.