Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6900d7e

Browse files
committed
main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string
1 parent e844e68 commit 6900d7e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎main/php_variables.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ PHPAPI void php_build_argv(const char *s, zval *track_vars_array)
676676
}
677677
}
678678
} else if (s && *s) {
679+
zend_error(E_DEPRECATED, "Deriving $_SERVER['argc'] and $_SERVER['argv'] from $_SERVER['QUERY_STRING'] is deprecated, configure register_argc_argv=0 to suppress this message and access the query parameters via $_SERVER['QUERY_STRING'] or $_GET");
679680
while (1) {
680681
const char *space = strchr(s, '+');
681682
/* auto-type */
@@ -785,10 +786,15 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
785786
PHPAPI zend_result php_hash_environment(void)
786787
{
787788
memset(PG(http_globals), 0, sizeof(PG(http_globals)));
788-
zend_activate_auto_globals();
789789
if (PG(register_argc_argv)) {
790-
php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]);
790+
/* Register $argc and $argv for CLI SAPIs. $_SERVER['argc'] and $_SERVER['argv']
791+
* will be registered in php_auto_globals_create_server() which clears
792+
* PG(http_globals)[TRACK_VARS_SERVER] anyways, making registration at this point
793+
* useless.
794+
*/
795+
php_build_argv(NULL, NULL);
791796
}
797+
zend_activate_auto_globals();
792798
return SUCCESS;
793799
}
794800
/* }}} */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /