Skip to content

Commit 2d7056b

Browse files
committed
main: Change the register_argc_argv INI default to Off
This partly implements the deprecation of the `register_argc_argv` INI setting by updating the default value to ensure safe behavior when no INI file is loaded. The actual deprecation warning will follow separately, since it is non-trivial to implement with the desired per-SAPI behavior. RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive
1 parent 20c8c12 commit 2d7056b

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ PHP_INI_BEGIN()
805805
STD_PHP_INI_BOOLEAN("report_zend_debug", "0", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals)
806806
STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals)
807807
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals)
808-
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
808+
STD_PHP_INI_BOOLEAN("register_argc_argv", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
809809
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
810810
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
811811

php.ini-development

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@
129129
; Development Value: 4096
130130
; Production Value: 4096
131131

132-
; register_argc_argv
133-
; Default Value: On
134-
; Development Value: Off
135-
; Production Value: Off
136-
137132
; request_order
138133
; Default Value: None
139134
; Development Value: "GP"
@@ -676,14 +671,12 @@ request_order = "GP"
676671
; that were passed when the script was invoked. These arrays are extremely
677672
; useful when running scripts from the command line. When this directive is
678673
; enabled, registering these variables consumes CPU cycles and memory each time
679-
; a script is executed. For performance reasons, this feature should be disabled
680-
; on production servers.
674+
; a script is executed. For security reasons, this feature should be disabled
675+
; for non-CLI SAPIs.
681676
; Note: This directive is hardcoded to On for the CLI SAPI
682-
; Default Value: On
683-
; Development Value: Off
684-
; Production Value: Off
677+
; This directive is deprecated.
685678
; https://php.net/register-argc-argv
686-
register_argc_argv = Off
679+
;register_argc_argv = Off
687680

688681
; When enabled, the ENV, REQUEST and SERVER variables are created when they're
689682
; first used (Just In Time) instead of when the script starts. If these

php.ini-production

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@
129129
; Development Value: 4096
130130
; Production Value: 4096
131131

132-
; register_argc_argv
133-
; Default Value: On
134-
; Development Value: Off
135-
; Production Value: Off
136-
137132
; request_order
138133
; Default Value: None
139134
; Development Value: "GP"
@@ -678,14 +673,12 @@ request_order = "GP"
678673
; that were passed when the script was invoked. These arrays are extremely
679674
; useful when running scripts from the command line. When this directive is
680675
; enabled, registering these variables consumes CPU cycles and memory each time
681-
; a script is executed. For performance reasons, this feature should be disabled
682-
; on production servers.
676+
; a script is executed. For security reasons, this feature should be disabled
677+
; for non-CLI SAPIs.
683678
; Note: This directive is hardcoded to On for the CLI SAPI
684-
; Default Value: On
685-
; Development Value: Off
686-
; Production Value: Off
679+
; This directive is deprecated.
687680
; https://php.net/register-argc-argv
688-
register_argc_argv = Off
681+
;register_argc_argv = Off
689682

690683
; When enabled, the ENV, REQUEST and SERVER variables are created when they're
691684
; first used (Just In Time) instead of when the script starts. If these

0 commit comments

Comments
 (0)