MFB51: Fixed bug #35594 (Multiple calls to getopt() may result in a crash).

This commit is contained in:
Ilia Alshanetsky 2005-12-08 03:25:42 +00:00
parent 04ee70f6eb
commit 331b7d7b27

View File

@ -1670,6 +1670,9 @@ PHP_FUNCTION(getopt)
/* Disable getopt()'s error messages. */
opterr = 0;
/* Force reinitialization of getopt() (via optind reset) on every call. */
optind = 0;
/* Invoke getopt(3) on the argument array. */
#ifdef HARTMUT_0
while ((o = getopt_long(argc, argv, options, longopts, &longindex)) != -1) {