summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-08 03:25:22 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-08 03:25:22 +0000
commitb30602b78b56c1cc3195b87a094d5f67776da9a3 (patch)
treeca5c52bb0e57182796f5839d487e2096b0ae5818
parent3d4c1d68869f98e5703973316ce86c7163b6b6f9 (diff)
downloadphp-git-b30602b78b56c1cc3195b87a094d5f67776da9a3.tar.gz
Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
-rw-r--r--NEWS2
-rw-r--r--ext/standard/basic_functions.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index abf086b34f..e68e15540d 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP NEWS
- Fixed many bugs in OCI8. (Tony)
- Fixed crash and leak in mysqli when using 4.1.x client libraries and
connecting to 5.x server. (Andrey)
+- Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
+ (rabbitt at gmail dot com, Ilia)
- Fixed bug #35558 (mktime() interpreting 3 digit years incorrectly). (Ilia)
- Fixed bug #35543 (php crash when calling non existing method of a class
that extends PDO). (Tony)
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index f5d9661444..604ddf091d 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1665,6 +1665,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) {