diff options
author | Markus Fischer <mfischer@php.net> | 2001-11-11 04:09:08 +0000 |
---|---|---|
committer | Markus Fischer <mfischer@php.net> | 2001-11-11 04:09:08 +0000 |
commit | 3a1b1142fedf818adfef2e39d2d156ccebfe8c8e (patch) | |
tree | d756a5c6d2edc0d1d3529aae12f0bb9b83c35129 /pear/Console | |
parent | d672226d6f9d2d3af392fe75cb0fae07749df32c (diff) | |
download | php-git-3a1b1142fedf818adfef2e39d2d156ccebfe8c8e.tar.gz |
Add missing loop variable $i.
Suppress more warnings when using the option separator '--'.
Diffstat (limited to 'pear/Console')
-rw-r--r-- | pear/Console/Getopt.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pear/Console/Getopt.php b/pear/Console/Getopt.php index 41ea43d27f..b20bc6754a 100644 --- a/pear/Console/Getopt.php +++ b/pear/Console/Getopt.php @@ -75,7 +75,7 @@ class Console_Getopt { sort($long_options); reset($args); - while (list(, $arg) = each($args)) { + while (list($i, $arg) = each($args)) { /* The special element '--' means explicit end of options. Treat the rest of the arguments as non-options and end the loop. */ @@ -84,9 +84,9 @@ class Console_Getopt { break; } - if ($arg{0} != '-' || ($arg{1} == '-' && !$long_options)) { + if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { $non_opts[] = $arg; - } else if ($arg{1} == '-') { + } else if (strlen($arg) > 1 && $arg{1} == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); if (PEAR::isError($error)) return $error; |