]> granicus.if.org Git - php/commitdiff
Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 8 Dec 2005 03:25:22 +0000 (03:25 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 8 Dec 2005 03:25:22 +0000 (03:25 +0000)
NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index abf086b34f5275287b9ed737e6b9977d778b85d1..e68e15540df2ad19d63b745bed5186d35e3a104b 100644 (file)
--- 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)
index f5d96614441a5ce8e1ef8b1859c142ec83e2eaad..604ddf091de52f4ecd5e37e46fd628c72ec9fc88 100644 (file)
@@ -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) {