diff --git a/NEWS b/NEWS index 4938b79b0713..048976ba346a 100644 --- a/NEWS +++ b/NEWS @@ -169,6 +169,7 @@ PHP NEWS rmdir(), touch(), chmod() or stat(). (Ilia Alshanetsky) - Standard: + . Made extension names in ini_get_all() case-insensitive. (Weilin Du) . Fixed bug GH-25387 (Uploaded files leak in request_parse_body()). (Kévin Dunglas) . Fixed quoted_printable_decode() truncating input at NUL bytes. (Weilin Du) diff --git a/UPGRADING b/UPGRADING index d9242ecb3c17..4f9c01765908 100644 --- a/UPGRADING +++ b/UPGRADING @@ -60,6 +60,11 @@ PHP 8.7 UPGRADE NOTES application terminate one attribute and append further ones. - Standard: + . ini_get_all() now matches extension names case-insensitively using ASCII + rules, independently of the current locale. Names that differ only in + capitalization from a loaded extension now succeed instead of emitting a + warning and returning false. + RFC: https://wiki.php.net/rfc/case_insensitive_ini_get_all . bindec(), octdec(), hexdec() and base_convert() now throw an Exception when the passed string contains characters that are invalid for the specified number base. diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index db302ab724ab..9ae99b6f1eed 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1950,7 +1950,7 @@ PHP_FUNCTION(ini_get_all) zend_ini_sort_entries(); if (extname) { - if ((module = zend_hash_find_ptr(&module_registry, extname)) == NULL) { + if ((module = zend_hash_find_ptr_lc(&module_registry, extname)) == NULL) { php_error_docref(NULL, E_WARNING, "Extension \"%pS\" cannot be found", extname); RETURN_FALSE; } diff --git a/ext/standard/tests/general_functions/ini_get_all_case_insensitive.phpt b/ext/standard/tests/general_functions/ini_get_all_case_insensitive.phpt new file mode 100644 index 000000000000..fe1cd3350e17 --- /dev/null +++ b/ext/standard/tests/general_functions/ini_get_all_case_insensitive.phpt @@ -0,0 +1,36 @@ +--TEST-- +ini_get_all() accepts case-insensitive extension names +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +array(0) { +} +array(0) { +} + +Warning: ini_get_all(): Extension "NoSuchExtension" cannot be found in %s on line %d +bool(false) + +Warning: ini_get_all(): Extension "NoSuchExtension" cannot be found in %s on line %d +bool(false)