Permalink
Browse files

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

  • Loading branch information...
1 parent 3d4c1d6 commit b30602b78b56c1cc3195b87a094d5f67776da9a3 Ilia Alshanetsky committed Dec 8, 2005
Showing with 5 additions and 0 deletions.
  1. +2 −0 NEWS
  2. +3 −0 ext/standard/basic_functions.c
View
2 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)
@@ -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) {

0 comments on commit b30602b

Please sign in to comment.