From e0a0b8a21e71d37c6aa95b446582cf2084b011d5 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 23 May 2026 08:49:03 +0200 Subject: [PATCH 1/3] Closes #22133 --- UPGRADING | 6 ++++ ext/standard/basic_functions.c | 6 ++++ .../tests/general_functions/ini_get_all.phpt | 12 +++++-- .../ini_get_all_default_value.phpt | 33 +++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 ext/standard/tests/general_functions/ini_get_all_default_value.phpt diff --git a/UPGRADING b/UPGRADING index a3b22d8c0560..443368b197a6 100644 --- a/UPGRADING +++ b/UPGRADING @@ -268,6 +268,12 @@ PHP 8.6 UPGRADE NOTES when not null, and on failure, gives the error code (one of the EAI_* constants). +- Standard: + . ini_get_all() now includes a "default_value" element for each directive + when $details is true. It holds the compiled-in default value of the + directive (or null if it has none), independent of values set in php.ini, + on the command line, or at runtime. + ======================================== 6. New Functions ======================================== diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 29ed6ddf14e9..d23d147c272c 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1955,6 +1955,12 @@ PHP_FUNCTION(ini_get_all) add_assoc_null(&option, "local_value"); } + if (ini_entry->def->value) { + add_assoc_stringl(&option, "default_value", ini_entry->def->value, ini_entry->def->value_length); + } else { + add_assoc_null(&option, "default_value"); + } + add_assoc_long(&option, "access", ini_entry->modifiable); zend_symtable_update(Z_ARRVAL_P(return_value), ini_entry->name, &option); diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt index 2b71b474a013..a6f25cab7717 100644 --- a/ext/standard/tests/general_functions/ini_get_all.phpt +++ b/ext/standard/tests/general_functions/ini_get_all.phpt @@ -33,29 +33,35 @@ array(0) { } array(3) { ["pcre.backtrack_limit"]=> - array(3) { + array(4) { ["global_value"]=> string(7) "1000000" ["local_value"]=> string(7) "1000000" + ["default_value"]=> + string(7) "1000000" ["access"]=> int(7) } ["pcre.jit"]=> - array(3) { + array(4) { ["global_value"]=> string(1) "1" ["local_value"]=> string(1) "1" + ["default_value"]=> + string(1) "1" ["access"]=> int(7) } ["pcre.recursion_limit"]=> - array(3) { + array(4) { ["global_value"]=> string(6) "100000" ["local_value"]=> string(6) "100000" + ["default_value"]=> + string(6) "100000" ["access"]=> int(7) } diff --git a/ext/standard/tests/general_functions/ini_get_all_default_value.phpt b/ext/standard/tests/general_functions/ini_get_all_default_value.phpt new file mode 100644 index 000000000000..b0ec8c8d5600 --- /dev/null +++ b/ext/standard/tests/general_functions/ini_get_all_default_value.phpt @@ -0,0 +1,33 @@ +--TEST-- +ini_get_all() exposes the compiled-in default_value independent of configuration and runtime changes +--INI-- +precision=8 +--FILE-- + +--EXPECT-- +string(1) "8" +string(1) "8" +string(2) "14" +string(1) "8" +string(1) "3" +string(2) "14" +Done From 23bf4518e13c30b93673981a788e5c131e01a402 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 23 May 2026 10:27:22 +0200 Subject: [PATCH 2/3] Add test --- .../ini_get_all_default_value_null.phpt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt diff --git a/ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt b/ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt new file mode 100644 index 000000000000..ec20baeddb6c --- /dev/null +++ b/ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt @@ -0,0 +1,33 @@ +--TEST-- +ini_get_all() reports a null default_value for a directive that has no compiled-in default +--INI-- +error_append_string=FOO +--FILE-- + +--EXPECT-- +string(3) "FOO" +string(3) "FOO" +NULL +string(3) "FOO" +string(3) "BAR" +NULL +Done From c4d698f591d0b8328b67c6e23fdf0108911a3b91 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 23 May 2026 12:29:23 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Implement=20suggestions=20by=20Tim=20D?= =?UTF-8?q?=C3=BCsterhus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UPGRADING | 8 ++++---- ext/standard/basic_functions.c | 4 ++-- ext/standard/tests/general_functions/ini_get_all.phpt | 6 +++--- ..._value.phpt => ini_get_all_builtin_default_value.phpt} | 8 ++++---- ...l.phpt => ini_get_all_builtin_default_value_null.phpt} | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) rename ext/standard/tests/general_functions/{ini_get_all_default_value.phpt => ini_get_all_builtin_default_value.phpt} (65%) rename ext/standard/tests/general_functions/{ini_get_all_default_value_null.phpt => ini_get_all_builtin_default_value_null.phpt} (64%) diff --git a/UPGRADING b/UPGRADING index 443368b197a6..fadd1e1ce5d3 100644 --- a/UPGRADING +++ b/UPGRADING @@ -269,10 +269,10 @@ PHP 8.6 UPGRADE NOTES constants). - Standard: - . ini_get_all() now includes a "default_value" element for each directive - when $details is true. It holds the compiled-in default value of the - directive (or null if it has none), independent of values set in php.ini, - on the command line, or at runtime. + . ini_get_all() now includes a "builtin_default_value" element for each + directive when $details is true. It holds the built-in default value of + the directive (or null if it has none), independent of values set in + php.ini, on the command line, or at runtime. ======================================== 6. New Functions diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d23d147c272c..2a0e7a786738 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1956,9 +1956,9 @@ PHP_FUNCTION(ini_get_all) } if (ini_entry->def->value) { - add_assoc_stringl(&option, "default_value", ini_entry->def->value, ini_entry->def->value_length); + add_assoc_stringl(&option, "builtin_default_value", ini_entry->def->value, ini_entry->def->value_length); } else { - add_assoc_null(&option, "default_value"); + add_assoc_null(&option, "builtin_default_value"); } add_assoc_long(&option, "access", ini_entry->modifiable); diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt index a6f25cab7717..c54b39ac3325 100644 --- a/ext/standard/tests/general_functions/ini_get_all.phpt +++ b/ext/standard/tests/general_functions/ini_get_all.phpt @@ -38,7 +38,7 @@ array(3) { string(7) "1000000" ["local_value"]=> string(7) "1000000" - ["default_value"]=> + ["builtin_default_value"]=> string(7) "1000000" ["access"]=> int(7) @@ -49,7 +49,7 @@ array(3) { string(1) "1" ["local_value"]=> string(1) "1" - ["default_value"]=> + ["builtin_default_value"]=> string(1) "1" ["access"]=> int(7) @@ -60,7 +60,7 @@ array(3) { string(6) "100000" ["local_value"]=> string(6) "100000" - ["default_value"]=> + ["builtin_default_value"]=> string(6) "100000" ["access"]=> int(7) diff --git a/ext/standard/tests/general_functions/ini_get_all_default_value.phpt b/ext/standard/tests/general_functions/ini_get_all_builtin_default_value.phpt similarity index 65% rename from ext/standard/tests/general_functions/ini_get_all_default_value.phpt rename to ext/standard/tests/general_functions/ini_get_all_builtin_default_value.phpt index b0ec8c8d5600..82de8781caa7 100644 --- a/ext/standard/tests/general_functions/ini_get_all_default_value.phpt +++ b/ext/standard/tests/general_functions/ini_get_all_builtin_default_value.phpt @@ -1,5 +1,5 @@ --TEST-- -ini_get_all() exposes the compiled-in default_value independent of configuration and runtime changes +ini_get_all() exposes the built-in default value independent of configuration and runtime changes --INI-- precision=8 --FILE-- @@ -10,16 +10,16 @@ $all = ini_get_all(null, true); var_dump($all["precision"]["global_value"]); var_dump($all["precision"]["local_value"]); -var_dump($all["precision"]["default_value"]); +var_dump($all["precision"]["builtin_default_value"]); -// A runtime change must not affect default_value. +// A runtime change must not affect builtin_default_value. ini_set("precision", "3"); $all = ini_get_all(null, true); var_dump($all["precision"]["global_value"]); var_dump($all["precision"]["local_value"]); -var_dump($all["precision"]["default_value"]); +var_dump($all["precision"]["builtin_default_value"]); echo "Done\n"; ?> diff --git a/ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt b/ext/standard/tests/general_functions/ini_get_all_builtin_default_value_null.phpt similarity index 64% rename from ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt rename to ext/standard/tests/general_functions/ini_get_all_builtin_default_value_null.phpt index ec20baeddb6c..efd86eb947e4 100644 --- a/ext/standard/tests/general_functions/ini_get_all_default_value_null.phpt +++ b/ext/standard/tests/general_functions/ini_get_all_builtin_default_value_null.phpt @@ -1,17 +1,17 @@ --TEST-- -ini_get_all() reports a null default_value for a directive that has no compiled-in default +ini_get_all() reports a null built-in default value for a directive that has no compiled-in default --INI-- error_append_string=FOO --FILE--