summaryrefslogtreecommitdiff
path: root/main/getopt.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2010-04-08 15:27:21 +0000
committerAntony Dovgal <tony2001@php.net>2010-04-08 15:27:21 +0000
commit14d1095a5c3f9d31137e16417efaa86425e9d769 (patch)
treedcf1d8a40d4d1a19e2e6e481fadb615475ffef43 /main/getopt.c
parentc0531d8db063775f86b34776c29fc9265a6184e6 (diff)
downloadphp-git-14d1095a5c3f9d31137e16417efaa86425e9d769.tar.gz
make sure the actual length of the argument passed matches the
length of the argument declared this fixes things like `php --zend-exten=1` or `php-fpm --fpm-con=conf`
Diffstat (limited to 'main/getopt.c')
-rw-r--r--main/getopt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main/getopt.c b/main/getopt.c
index 1f0be6842e..c40d4607ac 100644
--- a/main/getopt.c
+++ b/main/getopt.c
@@ -107,9 +107,15 @@ PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char
break;
}
}
- optchr = 0;
- dash = 0;
- arg_start += strlen(opts[php_optidx].opt_name);
+
+ if (arg_end == strlen(opts[php_optidx].opt_name)) {
+ optchr = 0;
+ dash = 0;
+ arg_start += strlen(opts[php_optidx].opt_name);
+ } else {
+ (*optind)++;
+ return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRNF, show_err));
+ }
} else {
if (!dash) {
dash = 1;