summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-08 03:25:42 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-08 03:25:42 +0000
commit331b7d7b273633c1957afa0378fab1df44afa309 (patch)
tree9b78dae101a384337a22473aa1f3480ee2d61cce /ext
parent04ee70f6eba5c29c729f7a662e76a37b1ccb17d7 (diff)
downloadphp-git-331b7d7b273633c1957afa0378fab1df44afa309.tar.gz
MFB51: Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/basic_functions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 914d339826..7999b759e7 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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) {