Skip to content

Commit 30cb1ec

Browse files
committed
Changed behaviour of allowed return statuses.
1 parent 8cdcc26 commit 30cb1ec

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
@@ -82,9 +82,9 @@ public static function exec1($command, $returnVars = [0], $ignoreStdErr = false)
8282
* redirected to /dev/null.
8383
* @param null|string $stderr The filename to redirect the standard error. If null the standard error is
8484
* redirected to the standard output. Use '/dev/null' to ignore standard error.
85-
* @param int[] $returnVars The allowed return statuses. If the return status of the command is not in
86-
* this array an exception will be thrown. An empty array or null will allow all
87-
* return statuses.
85+
* @param null|int[] $returnVars The allowed return statuses. If the return status of the command is not in
86+
* this array an exception will be thrown. Null will allow all return statuses and an
87+
* empty array will throw an exception always.
8888
*
8989
* @return int The exit status of the external program.
9090
*
@@ -116,7 +116,7 @@ public static function exec2($command, $stdout = null, $stderr = null, $returnVa
116116

117117
exec($command, $output, $return_var);
118118

119-
if (!empty($returnVars) && !in_array($return_var, $returnVars))
119+
if (is_array($returnVars) && !in_array($return_var, $returnVars))
120120
{
121121
throw new ProgramExecutionException($command, $return_var, $output);
122122
}

0 commit comments

Comments
 (0)