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 090baf3

Browse files
committed
main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string
1 parent 93974c6 commit 090baf3

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
@@ -785,10 +785,15 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
785785
PHPAPI zend_result php_hash_environment(void)
786786
{
787787
memset(PG(http_globals), 0, sizeof(PG(http_globals)));
788-
zend_activate_auto_globals();
789788
if (PG(register_argc_argv)) {
790-
php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]);
789+
/* Register $argc and $argv for CLI SAPIs. $_SERVER['argc'] and $_SERVER['argv']
790+
* will be registered in php_auto_globals_create_server() which clears
791+
* PG(http_globals)[TRACK_VARS_SERVER] anyways, making registration at this point
792+
* useless.
793+
*/
794+
php_build_argv(NULL, NULL);
791795
}
796+
zend_activate_auto_globals();
792797
return SUCCESS;
793798
}
794799
/* }}} */
@@ -886,6 +891,7 @@ static bool php_auto_globals_create_server(zend_string *name)
886891
zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGC), argc);
887892
}
888893
} else {
894+
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");
889895
php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]);
890896
}
891897
}

0 commit comments

Comments
(0)

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