safe icon indicating copy to clipboard operation
safe copied to clipboard

shell_exec() null cannot be used to detect failures

Open dbrekelmans opened this issue 4 years ago • 1 comments

The Safe\shell_exec function currently throws an exception when null is returned from \shell_exec. A null return is not always equal to an error occording to the docs.

https://www.php.net/manual/en/function.shell-exec.php

This function can return null both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function.

dbrekelmans avatar Jul 28 '21 11:07 dbrekelmans

Also \shell_exec returns false for a different category of error, which Safe\shell_exec doesn't handle at all :(

shish avatar Feb 20 '24 00:02 shish