Skip to content

Commit 68ab716

Browse files
committed
Fixed #69015 (php-cgi's getopt does not see $argv)
No test script is added because of complicated
1 parent c2062ca commit 68ab716

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ PHP NEWS
1313
. Fix bug #61285, #68329, #68046, #41631: encrypted streams don't observe
1414
socket timeouts (Brad Broerman)
1515

16+
- CGI:
17+
. Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence)
18+
1619
?? ??? 2015, PHP 5.5.22
1720

1821
- Core:

ext/standard/basic_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,8 +4255,8 @@ PHP_FUNCTION(getopt)
42554255
/* Get argv from the global symbol table. We calculate argc ourselves
42564256
* in order to be on the safe side, even though it is also available
42574257
* from the symbol table. */
4258-
if (PG(http_globals)[TRACK_VARS_SERVER] &&
4259-
(zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
4258+
if ((PG(http_globals)[TRACK_VARS_SERVER] || zend_is_auto_global(ZEND_STRL("_SERVER") TSRMLS_CC)) &&
4259+
(zend_hash_find(Z_ARRVAL_P((PG(http_globals))[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
42604260
zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) && Z_TYPE_PP(args) == IS_ARRAY
42614261
) {
42624262
int pos = 0;

0 commit comments

Comments
 (0)