From: Rasmus Lerdorf Date: Wed, 10 Mar 2004 19:12:49 +0000 (+0000) Subject: getopt() doesn't work if variables_order does not include "S" because it X-Git-Tag: php-5.0.0RC1RC1~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05f8b4e6bc76724e9f37de5c209d77b260617309;p=php getopt() doesn't work if variables_order does not include "S" because it only looks in $_SERVER for argv. So, if we don't find argv in $_SERVER fall back to looking in the global symbol table where register_argc_argv would have put it. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e2bb00abbe..46ec37f640 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1405,8 +1405,8 @@ PHP_FUNCTION(getopt) * in order to be on the safe side, even though it is also available * from the symbol table. */ - if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), - (void **) &args) != FAILURE) { + if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE || + zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) { int pos = 0; zval **arg;