From 4c04ff33c969f5371efb4b25a155dba50db701b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 9 Sep 2025 08:37:51 +0200 Subject: [PATCH 1/5] uri: Make the `.free_uri` handlers safe to call with `NULL` (#19627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * uri: Make the `.free_uri` handlers safe to call with `NULL` The `php_uri_free()` function already unconditionally called `->free_uri()` and thus couldn't be safely used when the `->uri` was `NULL` for some reason. The lexbor implementation was already safe, because `lxb_url_destroy()` is guaranteed to be a noop for `NULL`. * uri: Stop checking for `NULL` before calling `->free_uri()` This implicitly fixes an `UNEXPECTED(…->uri != NULL)` in `uri_free_obj_handler` that likely should have read `EXPECTED` instead. * uri: Remove unnecessary reset of `->uri` to `NULL` in `php_uri_object_handler_free()` * uri: Document the requirement of `free_uri()` being safe with `NULL` --- ext/uri/php_uri.c | 11 ++--------- ext/uri/php_uri_common.h | 2 +- ext/uri/uri_parser_php_parse_url.c | 4 ++++ ext/uri/uri_parser_rfc3986.c | 6 +++++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c index f9b5dadcc9763..ba4af1eb36623 100644 --- a/ext/uri/php_uri.c +++ b/ext/uri/php_uri.c @@ -830,9 +830,7 @@ static void uri_unserialize(INTERNAL_FUNCTION_PARAMETERS) } uri_internal_t *internal_uri = uri_internal_from_obj(object); - if (internal_uri->uri != NULL) { - internal_uri->parser->free_uri(internal_uri->uri); - } + internal_uri->parser->free_uri(internal_uri->uri); internal_uri->uri = internal_uri->parser->parse_uri(Z_STRVAL_P(uri_zv), Z_STRLEN_P(uri_zv), NULL, NULL, true); if (internal_uri->uri == NULL) { zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object", ZSTR_VAL(object->ce->name)); @@ -1025,12 +1023,7 @@ PHPAPI void php_uri_object_handler_free(zend_object *object) { uri_object_t *uri_object = uri_object_from_obj(object); - if (UNEXPECTED(uri_object->internal.uri != NULL)) { - uri_object->internal.parser->free_uri(uri_object->internal.uri); - uri_object->internal.parser = NULL; - uri_object->internal.uri = NULL; - } - + uri_object->internal.parser->free_uri(uri_object->internal.uri); zend_object_std_dtor(&uri_object->std); } diff --git a/ext/uri/php_uri_common.h b/ext/uri/php_uri_common.h index 999dca0e53ac4..1db692136e1a5 100644 --- a/ext/uri/php_uri_common.h +++ b/ext/uri/php_uri_common.h @@ -122,7 +122,7 @@ typedef struct uri_parser_t { /** * Frees the provided URI. * - * @param uri The input URI + * @param uri The URI to free. Must do nothing if NULL. */ void (*free_uri)(void *uri); diff --git a/ext/uri/uri_parser_php_parse_url.c b/ext/uri/uri_parser_php_parse_url.c index 8a22f9fa4dd04..1803bdb56fca7 100644 --- a/ext/uri/uri_parser_php_parse_url.c +++ b/ext/uri/uri_parser_php_parse_url.c @@ -158,6 +158,10 @@ static void uri_parser_php_parse_url_free(void *uri) { php_url *parse_url_uri = uri; + if (UNEXPECTED(parse_url_uri == NULL)) { + return; + } + php_url_free(parse_url_uri); } diff --git a/ext/uri/uri_parser_rfc3986.c b/ext/uri/uri_parser_rfc3986.c index 01f89f4ccc7c7..a4507a610d735 100644 --- a/ext/uri/uri_parser_rfc3986.c +++ b/ext/uri/uri_parser_rfc3986.c @@ -554,10 +554,14 @@ ZEND_ATTRIBUTE_NONNULL static zend_string *php_uri_parser_rfc3986_to_string(void return uri_string; } -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_rfc3986_free(void *uri) +static void php_uri_parser_rfc3986_free(void *uri) { php_uri_parser_rfc3986_uris *uriparser_uris = uri; + if (UNEXPECTED(uriparser_uris == NULL)) { + return; + } + uriFreeUriMembersMmA(&uriparser_uris->uri, mm); uriFreeUriMembersMmA(&uriparser_uris->normalized_uri, mm); From 9eedf0020633c28ac853d138ffc4e1f6c03af4a8 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com> Date: Tue, 9 Sep 2025 08:41:20 +0200 Subject: [PATCH 2/5] Fix intl tests naming (#19763) --- ext/intl/tests/gh11942_datefmt_locale_canonicalization.phpt | 2 +- ext/intl/tests/gh11942_numfmt_locale_canonicalization.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/tests/gh11942_datefmt_locale_canonicalization.phpt b/ext/intl/tests/gh11942_datefmt_locale_canonicalization.phpt index aec539ff14df1..26b0234fd3bdf 100644 --- a/ext/intl/tests/gh11942_datefmt_locale_canonicalization.phpt +++ b/ext/intl/tests/gh11942_datefmt_locale_canonicalization.phpt @@ -1,5 +1,5 @@ --TEST-- -Fix GH-11942: IntlDateFormatter should canonicalize locale strings +GH-11942 (IntlDateFormatter should canonicalize locale strings) --EXTENSIONS-- intl --FILE-- diff --git a/ext/intl/tests/gh11942_numfmt_locale_canonicalization.phpt b/ext/intl/tests/gh11942_numfmt_locale_canonicalization.phpt index 9a17c33672986..bdb753d6127bf 100644 --- a/ext/intl/tests/gh11942_numfmt_locale_canonicalization.phpt +++ b/ext/intl/tests/gh11942_numfmt_locale_canonicalization.phpt @@ -1,5 +1,5 @@ --TEST-- -Fix GH-11942: NumberFormatter should canonicalize locale strings +GH-11942 (NumberFormatter should canonicalize locale strings) --EXTENSIONS-- intl --FILE-- From b718514dc207317125fce97f9184b945192810f0 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com> Date: Tue, 9 Sep 2025 08:41:32 +0200 Subject: [PATCH 3/5] Fix memory leak when providing an invalid locale to IntlDateFormatter (#19764) --- ext/intl/dateformat/dateformat_create.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 853de5aecc08f..c2853bb906f61 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -119,8 +119,8 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin locale = Locale::createFromName(final_locale); /* get*Name accessors being set does not preclude being bogus */ if (locale.isBogus() || ((locale_len == 1 && locale_str[0] != 'C') || (locale_len > 1 && strlen(locale.getISO3Language()) == 0))) { - zend_argument_value_error(1, "\"%s\" is invalid", locale_str); - return FAILURE; + zend_argument_value_error(1, "\"%s\" is invalid", locale_str); + goto error; } /* process calendar */ From 3f66cbeb4d525cefe4c6d67934fa04eeadc20aa4 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com> Date: Tue, 9 Sep 2025 10:18:42 +0200 Subject: [PATCH 4/5] Use zend_string API for mail.cr_lf_mode validation (#19759) --- ext/standard/mail.c | 12 ++++++------ main/main.c | 13 ++++++------- main/php_globals.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index fb9db686124e8..f6161782bdd76 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -495,14 +495,14 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c } char *line_sep; - const char *cr_lf_mode = PG(mail_cr_lf_mode); + zend_string *cr_lf_mode = PG(mail_cr_lf_mode); - if (cr_lf_mode && strcmp(cr_lf_mode, "crlf") != 0) { - if (strcmp(cr_lf_mode, "lf") == 0) { + if (cr_lf_mode && !zend_string_equals_literal(cr_lf_mode, "crlf")) { + if (zend_string_equals_literal(cr_lf_mode, "lf")) { line_sep = "\n"; - } else if (strcmp(cr_lf_mode, "mixed") == 0) { + } else if (zend_string_equals_literal(cr_lf_mode, "mixed")) { line_sep = "\n"; - } else if (strcmp(cr_lf_mode, "os") == 0) { + } else if (zend_string_equals_literal(cr_lf_mode, "os")) { #ifdef PHP_WIN32 line_sep = "\r\n"; #else @@ -609,7 +609,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c fprintf(sendmail, "%s", line_sep); - if (cr_lf_mode && strcmp(cr_lf_mode, "lf") == 0) { + if (cr_lf_mode && zend_string_equals_literal(cr_lf_mode, "lf")) { char *converted_message = NULL; size_t msg_len = strlen(message); size_t new_len = 0; diff --git a/main/main.c b/main/main.c index a1515911fbfeb..db7de754143ac 100644 --- a/main/main.c +++ b/main/main.c @@ -725,12 +725,11 @@ static PHP_INI_MH(OnUpdateMailLog) static PHP_INI_MH(OnUpdateMailCrLfMode) { if (new_value) { - const char *val = ZSTR_VAL(new_value); if (ZSTR_LEN(new_value) > 0 && - strcmp(val, "crlf") != 0 && - strcmp(val, "lf") != 0 && - strcmp(val, "mixed") != 0 && - strcmp(val, "os") != 0) { + !zend_string_equals_literal(new_value, "crlf") && + !zend_string_equals_literal(new_value, "lf") && + !zend_string_equals_literal(new_value, "mixed") && + !zend_string_equals_literal(new_value, "os")) { int err_type; if (stage == ZEND_INI_STAGE_RUNTIME) { @@ -740,13 +739,13 @@ static PHP_INI_MH(OnUpdateMailCrLfMode) } if (stage != ZEND_INI_STAGE_DEACTIVATE) { - php_error_docref(NULL, err_type, "Invalid value \"%s\" for mail.cr_lf_mode. Must be one of: \"crlf\", \"lf\", \"mixed\", \"os\"", val); + php_error_docref(NULL, err_type, "Invalid value \"%s\" for mail.cr_lf_mode. Must be one of: \"crlf\", \"lf\", \"mixed\", \"os\"", ZSTR_VAL(new_value)); } return FAILURE; } } - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); + OnUpdateStr(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); return SUCCESS; } /* }}} */ diff --git a/main/php_globals.h b/main/php_globals.h index 028089ab43c69..893bf25d26cb5 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -152,9 +152,9 @@ struct _php_core_globals { char *request_order; char *mail_log; + zend_string *mail_cr_lf_mode; bool mail_x_header; bool mail_mixed_lf_and_crlf; - char *mail_cr_lf_mode; bool in_error_log; From 37bf0ec9610d7faf5d24bad58c8873f2452fcb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 9 Sep 2025 10:34:35 +0200 Subject: [PATCH 5/5] main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string (#19606) * main: Ignore `register_argc_argv` when `SG(request_info).argc` is available * sapi: Remove hardcoded `register_argc_argv` for CLI SAPIs This INI is ignored since the previous commit, which makes the hardcoded setting obsolete. * main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive * main: Adjust deprecation message for `register_argc_argv` * NEWS/UPGRADING --- NEWS | 2 + UPGRADING | 5 ++ .../tests/general_functions/bug43293_1.phpt | 3 +- main/php_variables.c | 30 ++++---- php.ini-development | 2 +- php.ini-production | 2 +- sapi/cli/php_cli.c | 1 - sapi/embed/php_embed.c | 1 - .../bug75712-getenv-server-vars_001.phpt | 68 +++++++++++++++++++ ...t => bug75712-getenv-server-vars_002.phpt} | 4 +- sapi/phpdbg/phpdbg.c | 1 - tests/basic/011.phpt | 3 +- tests/basic/011_empty_query.phpt | 20 ++++++ .../011_register_argc_argv_disabled.phpt | 22 ++++++ tests/basic/011_windows.phpt | 3 +- .../012_register_argc_argv_disabled.phpt | 49 +++++++++++++ 16 files changed, 192 insertions(+), 24 deletions(-) create mode 100644 sapi/fpm/tests/bug75712-getenv-server-vars_001.phpt rename sapi/fpm/tests/{bug75712-getenv-server-vars.phpt => bug75712-getenv-server-vars_002.phpt} (88%) create mode 100644 tests/basic/011_empty_query.phpt create mode 100644 tests/basic/011_register_argc_argv_disabled.phpt create mode 100644 tests/basic/012_register_argc_argv_disabled.phpt diff --git a/NEWS b/NEWS index 9ab1a40d3e46f..70793b0339f80 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ PHP NEWS deprecated. (alexandre-daubois) . Fixed bug GH-19681 (PHP_EXPAND_PATH broken with bash 5.3.0). (Remi) . Marks the stack as non-executable on Haiku. (David Carlier) + . Deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string is + now deprecated. (timwolla, nicolasgrekas) - CLI: . Fixed bug GH-19461 (Improve error message on listening error with IPv6 diff --git a/UPGRADING b/UPGRADING index 24cd70d87a05a..57ca93d43d3c8 100644 --- a/UPGRADING +++ b/UPGRADING @@ -387,6 +387,11 @@ PHP 8.5 UPGRADE NOTES . Using null as an array offset or when calling array_key_exists() is now deprecated. Instead an empty string should be used. RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists + . Deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string for non-CLI + SAPIs has been deprecated. Configure register_argc_argv=0 and switch to either + $_GET or $_SERVER['QUERY_STRING'] to access the information, after verifying + that the usage is safe. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive - Curl: . The curl_close() function has been deprecated, as CurlHandle objects are diff --git a/ext/standard/tests/general_functions/bug43293_1.phpt b/ext/standard/tests/general_functions/bug43293_1.phpt index c1f618f2bd0e6..fce2ac482cd86 100644 --- a/ext/standard/tests/general_functions/bug43293_1.phpt +++ b/ext/standard/tests/general_functions/bug43293_1.phpt @@ -21,4 +21,5 @@ array(3) { [2]=> int(3) } -bool(false) +array(0) { +} diff --git a/main/php_variables.c b/main/php_variables.c index 91eb0a7f5ceac..707564e680239 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -785,10 +785,13 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src) PHPAPI zend_result php_hash_environment(void) { memset(PG(http_globals), 0, sizeof(PG(http_globals))); + /* Register $argc and $argv for CLI SAPIs. $_SERVER['argc'] and $_SERVER['argv'] + * will be registered in php_auto_globals_create_server() which clears + * PG(http_globals)[TRACK_VARS_SERVER] anyways, making registration at this point + * useless. + */ + php_build_argv(NULL, NULL); zend_activate_auto_globals(); - if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); - } return SUCCESS; } /* }}} */ @@ -875,19 +878,18 @@ static bool php_auto_globals_create_server(zend_string *name) if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) { php_register_server_variables(); - if (PG(register_argc_argv)) { - if (SG(request_info).argc) { - zval *argc, *argv; + if (SG(request_info).argc) { + zval *argc, *argv; - if ((argc = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGC), 1)) != NULL && - (argv = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGV), 1)) != NULL) { - Z_ADDREF_P(argv); - zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGV), argv); - zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGC), argc); - } - } else { - php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); + if ((argc = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGC), 1)) != NULL && + (argv = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGV), 1)) != NULL) { + Z_ADDREF_P(argv); + zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGV), argv); + zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGC), argc); } + } else if (PG(register_argc_argv)) { + zend_error(E_DEPRECATED, "Deriving $_SERVER['argv'] from the query string is deprecated. Configure register_argc_argv=0 to turn this message off"); + php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); } } else { diff --git a/php.ini-development b/php.ini-development index 0fd6920c2fb30..7018682fb0d9a 100644 --- a/php.ini-development +++ b/php.ini-development @@ -662,7 +662,7 @@ request_order = "GP" ; enabled, registering these variables consumes CPU cycles and memory each time ; a script is executed. For security reasons, this feature should be disabled ; for non-CLI SAPIs. -; Note: This directive is hardcoded to On for the CLI SAPI +; Note: This directive is ignored for the CLI SAPI ; This directive is deprecated. ; https://php.net/register-argc-argv ;register_argc_argv = Off diff --git a/php.ini-production b/php.ini-production index d555eb9ff7495..602d005afd54f 100644 --- a/php.ini-production +++ b/php.ini-production @@ -664,7 +664,7 @@ request_order = "GP" ; enabled, registering these variables consumes CPU cycles and memory each time ; a script is executed. For security reasons, this feature should be disabled ; for non-CLI SAPIs. -; Note: This directive is hardcoded to On for the CLI SAPI +; Note: This directive is ignored for the CLI SAPI ; This directive is deprecated. ; https://php.net/register-argc-argv ;register_argc_argv = Off diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index e212a0f71a23d..460acb62664a6 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -115,7 +115,6 @@ PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks(void) static const char HARDCODED_INI[] = "html_errors=0\n" - "register_argc_argv=1\n" "implicit_flush=1\n" "output_buffering=0\n" "max_execution_time=0\n" diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index c18480d07d313..06cd1fb0763b7 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -25,7 +25,6 @@ static const char HARDCODED_INI[] = "html_errors=0\n" - "register_argc_argv=1\n" "implicit_flush=1\n" "output_buffering=0\n" "max_execution_time=0\n" diff --git a/sapi/fpm/tests/bug75712-getenv-server-vars_001.phpt b/sapi/fpm/tests/bug75712-getenv-server-vars_001.phpt new file mode 100644 index 0000000000000..05ac22f304e99 --- /dev/null +++ b/sapi/fpm/tests/bug75712-getenv-server-vars_001.phpt @@ -0,0 +1,68 @@ +--TEST-- +FPM: bug75712 - getenv should not read from $_ENV and $_SERVER +--SKIPIF-- + +--FILE-- +start(); +$tester->expectLogStartNotices(); +$response = $tester->request(); +echo "=====", PHP_EOL; +$response->printBody(); +echo "=====", PHP_EOL; +$tester->terminate(); +$tester->close(); + +?> +Done +--EXPECTF-- +===== +Deprecated: Deriving $_SERVER['argv'] from the query string is deprecated. Configure register_argc_argv=0 to turn this message off in %s on line %d +bool(false) +bool(true) +string(4) "test" +bool(false) +bool(false) +string(2) "dt" +string(2) "dt" +===== +Done +--CLEAN-- + diff --git a/sapi/fpm/tests/bug75712-getenv-server-vars.phpt b/sapi/fpm/tests/bug75712-getenv-server-vars_002.phpt similarity index 88% rename from sapi/fpm/tests/bug75712-getenv-server-vars.phpt rename to sapi/fpm/tests/bug75712-getenv-server-vars_002.phpt index 49d9535a6b03a..b34d936eaf223 100644 --- a/sapi/fpm/tests/bug75712-getenv-server-vars.phpt +++ b/sapi/fpm/tests/bug75712-getenv-server-vars_002.phpt @@ -1,5 +1,5 @@ --TEST-- -FPM: bug75712 - getenv should not read from $_ENV and $_SERVER +FPM: bug75712 - getenv should not read from $_ENV and $_SERVER (register_argc_argv=off) --SKIPIF-- --FILE-- @@ -15,7 +15,7 @@ listen = {{ADDR}} pm = static pm.max_children = 1 env[TEST] = test -php_value[register_argc_argv] = on +php_value[register_argc_argv] = off EOT; $code = << ---EXPECT-- +--EXPECTF-- +Deprecated: Deriving $_SERVER['argv'] from the query string is deprecated. Configure register_argc_argv=0 to turn this message off in %s on line %d 0: ab 1: cd 2: ef diff --git a/tests/basic/011_empty_query.phpt b/tests/basic/011_empty_query.phpt new file mode 100644 index 0000000000000..a6e8ad8ef9b87 --- /dev/null +++ b/tests/basic/011_empty_query.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing $argc and $argv handling (GET empty) +--SKIPIF-- + +--INI-- +register_argc_argv=1 +--CGI-- +--FILE-- + +--EXPECTF-- +Deprecated: Deriving $_SERVER['argv'] from the query string is deprecated. Configure register_argc_argv=0 to turn this message off in %s on line %d +int(0) +array(0) { +} diff --git a/tests/basic/011_register_argc_argv_disabled.phpt b/tests/basic/011_register_argc_argv_disabled.phpt new file mode 100644 index 0000000000000..0947a911dd0ff --- /dev/null +++ b/tests/basic/011_register_argc_argv_disabled.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing $argc and $argv handling (GET, register_argc_argv=0) +--SKIPIF-- + +--INI-- +register_argc_argv=0 +--GET-- +ab+cd+ef+123+test +--FILE-- + +--EXPECTF-- +Warning: Undefined array key "argc" in %s on line %d + +Warning: Undefined array key "argv" in %s on line %d +NULL +NULL diff --git a/tests/basic/011_windows.phpt b/tests/basic/011_windows.phpt index fd359fe4032af..c25853f98c5f5 100644 --- a/tests/basic/011_windows.phpt +++ b/tests/basic/011_windows.phpt @@ -14,7 +14,8 @@ for ($i=0; $i<$argc; $i++) { } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Deriving $_SERVER['argv'] from the query string is deprecated. Configure register_argc_argv=0 to turn this message off in %s on line %d 0: foo=ab 1: cd 2: ef diff --git a/tests/basic/012_register_argc_argv_disabled.phpt b/tests/basic/012_register_argc_argv_disabled.phpt new file mode 100644 index 0000000000000..415e39074f3b6 --- /dev/null +++ b/tests/basic/012_register_argc_argv_disabled.phpt @@ -0,0 +1,49 @@ +--TEST-- +Testing $argc and $argv handling (cli, register_argc_argv=0) +--INI-- +register_argc_argv=0 +variables_order=GPS +--ARGS-- +ab cd ef 123 test +--FILE-- + +--EXPECTF-- +int(6) +array(6) { + [0]=> + string(%d) "%s" + [1]=> + string(2) "ab" + [2]=> + string(2) "cd" + [3]=> + string(2) "ef" + [4]=> + string(3) "123" + [5]=> + string(4) "test" +} +int(6) +array(6) { + [0]=> + string(%d) "%s" + [1]=> + string(2) "ab" + [2]=> + string(2) "cd" + [3]=> + string(2) "ef" + [4]=> + string(3) "123" + [5]=> + string(4) "test" +}