]> granicus.if.org Git - php/commitdiff
Fixed #69015 (php-cgi's getopt does not see $argv)
authorXinchen Hui <laruence@php.net>
Fri, 13 Feb 2015 04:53:34 +0000 (12:53 +0800)
committerXinchen Hui <laruence@php.net>
Fri, 13 Feb 2015 04:53:34 +0000 (12:53 +0800)
No test script is added because of complicated

NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index 327673194e9e0f649db55ce0ae5c999e16cfdda3..f4801cc10d849d6e5fc7354ba262f3d3fcae3697 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,9 @@ PHP                                                                        NEWS
   . Fix bug #61285, #68329, #68046, #41631: encrypted streams don't observe
     socket timeouts (Brad Broerman)
 
+- CGI:
+  . Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence)
+
 ?? ??? 2015, PHP 5.5.22
 
 - Core:
index dad815b35b2e1095831619aadbcde33c99586920..48ffb338003f687010f85cc3d6af8f67487027c4 100644 (file)
@@ -4255,8 +4255,8 @@ PHP_FUNCTION(getopt)
        /* Get argv from the global symbol table. We calculate argc ourselves
         * in order to be on the safe side, even though it is also available
         * from the symbol table. */
-       if (PG(http_globals)[TRACK_VARS_SERVER] &&
-               (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
+       if ((PG(http_globals)[TRACK_VARS_SERVER] || zend_is_auto_global(ZEND_STRL("_SERVER") TSRMLS_CC)) &&
+               (zend_hash_find(Z_ARRVAL_P((PG(http_globals))[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
                zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) && Z_TYPE_PP(args) == IS_ARRAY
        ) {
                int pos = 0;