diff options
author | Urban Müller | 2021-03-29 17:26:59 +0200 |
---|---|---|
committer | Urban Müller | 2021-03-29 17:26:59 +0200 |
commit | 9bdb3cb5c665eab02b6e14345aeb4e69a20596c7 (patch) | |
tree | 4d15ab781c6245815335b788117243156db6fa4e | |
parent | 72b1b2091eb784b3f24dc415d44e865a455948c8 (diff) | |
download | itools-9bdb3cb5c665eab02b6e14345aeb4e69a20596c7.tar.gz itools-9bdb3cb5c665eab02b6e14345aeb4e69a20596c7.tar.bz2 itools-9bdb3cb5c665eab02b6e14345aeb4e69a20596c7.zip |
remove => false args in it::exec, consistent with it_html
-rw-r--r-- | it.class | 3 | ||||
-rwxr-xr-x | test/exec.t | 3 |
2 files changed, 5 insertions, 1 deletions
@@ -704,7 +704,8 @@ static function shell_command($cmd, ...$args) else { foreach ((array)$values[$key] as $value) - $parts[] = it::_exec_quotevalue($value, "cmd=$cmd key=$key val=$value"); + if ($value !== false) + $parts[] = it::_exec_quotevalue($value, "cmd=$cmd key=$key val=$value"); } $replacements[$tag] = implode(" ", $parts); diff --git a/test/exec.t b/test/exec.t index 5f78482..09e16da 100755 --- a/test/exec.t +++ b/test/exec.t @@ -9,6 +9,9 @@ is(it::exec("echo {0}", 'gna'), "gna\n", "exec with positional argument"); is(it::shell_command("echo {arg}", ['arg' => 'gna07,-:blah']), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); is(it::shell_command("echo {arg}", ['arg' => '2>&1']), "echo '2>&1'", "quote arguments with dangerous characters"); is(it::shell_command("echo {arg}", ['arg' => '']), "echo ''", "quote empty arguments"); +is(it::shell_command("echo {arg}", ['arg' => null]), "echo ", "remove null values"); +is(it::shell_command("echo {arg}", ['arg' => false]), "echo ", "remove false values"); +is(it::shell_command("echo {arg}", ['arg' => []]), "echo ", "remove empty arrays"); is( |