Skip to content

Commit 4d5ac8e

Browse files
committed
- Fix issue with long form of command line switches
1 parent e539805 commit 4d5ac8e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sapi/cli/getopt.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **opta
8989
}
9090
}
9191
optchr = 0;
92-
dash = 1;
93-
arg_start = 2 + strlen(opts[opts_idx].opt_name);
94-
}
95-
if (!dash) {
96-
dash = 1;
97-
optchr = 1;
98-
}
99-
100-
/* Check if the guy tries to do a -: kind of flag */
101-
if (argv[*optind][optchr] == ':') {
10292
dash = 0;
103-
(*optind)++;
104-
return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRCOLON, show_err));
93+
arg_start = 2 + strlen(opts[opts_idx].opt_name);
94+
} else {
95+
if (!dash) {
96+
dash = 1;
97+
optchr = 1;
98+
}
99+
/* Check if the guy tries to do a -: kind of flag */
100+
if (argv[*optind][optchr] == ':') {
101+
dash = 0;
102+
(*optind)++;
103+
return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRCOLON, show_err));
104+
}
105105
}
106106
if (opts_idx < 0) {
107107
while (1) {

0 commit comments

Comments
 (0)