Skip to content

Commit 102b99f

Browse files
committed
Changed behaviour of allowed return statuses.
1 parent eaf9667 commit 102b99f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Helper/ProgramExecution.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public static function escape($args)
3838
*
3939
* @param string[] $command The command that will be executed. This method will compose the command executed
4040
* by exec with proper escaping.
41-
* @param int[]|null $returnVars The allowed return statuses. If the return status of the command is not in this
42-
* array an exception will be thrown. An empty array or null will allow all return
43-
* statuses.
41+
* @param int[]|null $returnVars The allowed return statuses. If the return status of the command is not in
42+
* this array an exception will be thrown. Null will allow all return statuses and an
43+
* empty array will throw an exception always.
4444
* @param bool $ignoreStdErr The standard error is normally redirected to standard output. If true standard
4545
* error is ignored (i.e. redirected to /dev/null).
4646
*
@@ -64,7 +64,7 @@ public static function exec1($command, $returnVars = [0], $ignoreStdErr = false)
6464

6565
exec($command, $output, $return_var);
6666

67-
if (!empty($returnVars) && !in_array($return_var, $returnVars))
67+
if (is_array($returnVars) && !in_array($return_var, $returnVars))
6868
{
6969
throw new ProgramExecutionException($command, $return_var, $output);
7070
}

0 commit comments

Comments
 (0)