tony2001 Thu, 08 Apr 2010 15:27:21 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=297706
Log:
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`
Changed paths:
U php/php-src/branches/PHP_5_3/main/getopt.c
U php/php-src/branches/PHP_5_3_FPM/main/getopt.c
U php/php-src/trunk/main/getopt.c
Modified: php/php-src/branches/PHP_5_3/main/getopt.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/getopt.c 2010-04-08 15:03:55 UTC (rev
297705)
+++ php/php-src/branches/PHP_5_3/main/getopt.c 2010-04-08 15:27:21 UTC (rev
297706)
@@ -107,9 +107,15 @@
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;
Modified: php/php-src/branches/PHP_5_3_FPM/main/getopt.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/main/getopt.c 2010-04-08 15:03:55 UTC
(rev 297705)
+++ php/php-src/branches/PHP_5_3_FPM/main/getopt.c 2010-04-08 15:27:21 UTC
(rev 297706)
@@ -107,9 +107,15 @@
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;
Modified: php/php-src/trunk/main/getopt.c
===================================================================
--- php/php-src/trunk/main/getopt.c 2010-04-08 15:03:55 UTC (rev 297705)
+++ php/php-src/trunk/main/getopt.c 2010-04-08 15:27:21 UTC (rev 297706)
@@ -107,9 +107,15 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php