summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-02-13 12:53:34 +0800
committerXinchen Hui <laruence@php.net>2015-02-13 12:53:34 +0800
commit68ab716f188b901ebce3c4c249cba45fc36904ba (patch)
tree2eed0c5e7603e63f213e1c2a1e3e435676663839
parentc2062ca4705330c053463a891ee93c5e319fd464 (diff)
downloadphp-git-68ab716f188b901ebce3c4c249cba45fc36904ba.tar.gz
Fixed #69015 (php-cgi's getopt does not see $argv)
No test script is added because of complicated
-rw-r--r--NEWS3
-rw-r--r--ext/standard/basic_functions.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 327673194e..f4801cc10d 100644
--- 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:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index dad815b35b..48ffb33800 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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;