-
Notifications
You must be signed in to change notification settings - Fork 7.9k
main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string #19606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6ea0eb9
026d470
85f7cb1
d97f297
3556021
767ea7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,6 +384,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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ array(3) { | |
[2]=> | ||
int(3) | ||
} | ||
bool(false) | ||
array(0) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--TEST-- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: I usually prefer not to use 001 names in FPM to see immediately from the test name what it is for which was quite useful for me. But it's not a huge issue if there are few such tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are already some tests that are even less explaining... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I try to avoid those either, but in this case the two tests are very closely related and only differ in the INI value, so numbering them made sense to me. |
||
FPM: bug75712 - getenv should not read from $_ENV and $_SERVER | ||
--SKIPIF-- | ||
<?php include "skipif.inc"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once "tester.inc"; | ||
|
||
$cfg = <<<EOT | ||
[global] | ||
error_log = {{FILE:LOG}} | ||
[unconfined] | ||
listen = {{ADDR}} | ||
pm = static | ||
pm.max_children = 1 | ||
env[TEST] = test | ||
php_value[register_argc_argv] = on | ||
php_value[html_errors] = off | ||
EOT; | ||
|
||
$code = <<<EOT | ||
<?php | ||
|
||
var_dump(isset(getenv()['argv'])); | ||
var_dump(isset(getenv()['SERVER_NAME'])); | ||
var_dump(getenv()['TEST']); | ||
var_dump(isset(getenv()['DTEST'])); | ||
var_dump(getenv('DTEST')); | ||
putenv('DTEST=dt'); | ||
var_dump(getenv()['DTEST']); | ||
var_dump(getenv('DTEST')); | ||
|
||
function notcalled() | ||
{ | ||
\$_SERVER['argv']; | ||
} | ||
EOT; | ||
|
||
$tester = new FPM\Tester($cfg, $code); | ||
$tester->start(); | ||
$tester->expectLogStartNotices(); | ||
$response = $tester->request(); | ||
echo "=====", PHP_EOL; | ||
$response->printBody(); | ||
echo "=====", PHP_EOL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point of this echo..? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer not to do formatting in tests but if you feel it's important, it should be added to printBody (adding new parameter). It's a NIT though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of the |
||
$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-- | ||
<?php | ||
require_once "tester.inc"; | ||
FPM\Tester::clean(); | ||
?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Testing $argc and $argv handling (GET empty) | ||
--SKIPIF-- | ||
<?php | ||
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58");
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58");
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is consistent with |
||
?> | ||
--INI-- | ||
register_argc_argv=1 | ||
--CGI-- | ||
--FILE-- | ||
<?php | ||
|
||
var_dump($_SERVER['argc'], $_SERVER['argv']); | ||
|
||
?> | ||
--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) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Testing $argc and $argv handling (GET, register_argc_argv=0) | ||
--SKIPIF-- | ||
<?php | ||
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58");
if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows: --INI-- is ignored due to 4b9cd27ff5c0177dcb160caeae1ea79e761ada58");
|
||
?> | ||
--INI-- | ||
register_argc_argv=0 | ||
--GET-- | ||
ab+cd+ef+123+test | ||
--FILE-- | ||
<?php | ||
|
||
var_dump($_SERVER['argc'], $_SERVER['argv']); | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: Undefined array key "argc" in %s on line %d | ||
|
||
Warning: Undefined array key "argv" in %s on line %d | ||
NULL | ||
NULL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-- | ||
<?php | ||
|
||
var_dump( | ||
$argc, | ||
$argv, | ||
$_SERVER['argc'], | ||
$_SERVER['argv'], | ||
); | ||
|
||
?> | ||
--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" | ||
} |