]> granicus.if.org Git - php/commitdiff
MFH
authorRasmus Lerdorf <rasmus@php.net>
Fri, 12 Mar 2004 17:42:09 +0000 (17:42 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Fri, 12 Mar 2004 17:42:09 +0000 (17:42 +0000)
  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.

ext/standard/basic_functions.c

index 96ea2679f027e875017ef909545671b6fafcda8a..c2e6ad940384890e5fa91e29dc40064d239e4eb7 100644 (file)
@@ -1442,8 +1442,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;