diff options
Diffstat (limited to 'sapi/cli/getopt.c')
-rw-r--r-- | sapi/cli/getopt.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sapi/cli/getopt.c b/sapi/cli/getopt.c index dd44703803..fbe97e2f9f 100644 --- a/sapi/cli/getopt.c +++ b/sapi/cli/getopt.c @@ -79,11 +79,16 @@ int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **opta } if ((argv[*optind][0] == '-') && (argv[*optind][1] == '-')) { /* '--' indicates end of args if not followed by a known long option name */ + if (argv[*optind][2] == '\0') { + (*optind)++; + return(EOF); + } + while (1) { opts_idx++; if (opts[opts_idx].opt_char == '-') { (*optind)++; - return(EOF); + return(php_opt_error(argc, argv, *optind-1, optchr, OPTERRARG, show_err)); } else if (opts[opts_idx].opt_name && !strcmp(&argv[*optind][2], opts[opts_idx].opt_name)) { break; } |