From f7c9ddbf1a5f2e134ed44e9130b0b742cd24342c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 10 Jun 2013 14:01:49 -0400 Subject: [PATCH] Fixup argument parsing with no args (store_true) --- setup/cli/modules/class.module.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/cli/modules/class.module.php b/setup/cli/modules/class.module.php index 70c2eebeb..4ff5c7b1c 100644 --- a/setup/cli/modules/class.module.php +++ b/setup/cli/modules/class.module.php @@ -34,7 +34,7 @@ class Option { function handleValue(&$destination, $args) { $nargs = 0; - $value = array_shift($args); + $value = ($this->hasArg()) ? array_shift($args) : null; if ($value[0] == '-') $value = null; elseif ($value) @@ -62,7 +62,7 @@ class Option { function toString() { $short = explode(':', $this->short); $long = explode(':', $this->long); - if ($this->nargs == '?') + if ($this->nargs === '?') $switches = sprintf(' %s [%3$s], %s[=%3$s]', $short[0], $long[0], $this->metavar); elseif ($this->hasArg()) -- GitLab