[php-src] master: [RFC] Implement case-insensitive extension names in ini_get_all() (#25448)

From: Date: Mon, 16 Nov 2026 05:23:59 +0000
Subject: [php-src] master: [RFC] Implement case-insensitive extension names in ini_get_all() (#25448)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143726@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Committer: GitHub (web-flow) Pusher: LamentXU123 Date: 2026-11-16T13:23:56+08:00 Commit: https://github.com/php/php-src/commit/46da0fda907d44ca1705f682a286722e8966ef29 Raw diff: https://github.com/php/php-src/commit/46da0fda907d44ca1705f682a286722e8966ef29.diff [RFC] Implement case-insensitive extension names in ini_get_all() (#25448) This implement RFC: https://wiki.php.net/rfc/case_insensitive_ini_get_all Changed paths: A ext/standard/tests/general_functions/ini_get_all_case_insensitive.phpt M NEWS M UPGRADING M ext/standard/basic_functions.c Diff: diff --git a/NEWS b/NEWS index 94d00d96dffb..f8baf0e88078 100644 --- a/NEWS +++ b/NEWS @@ -171,6 +171,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-- +<?php +foreach (['PCRE', 'Pcre', 'pCrE'] as $extension) { + var_dump(ini_get_all($extension) === ini_get_all('pcre')); + var_dump(ini_get_all($extension, true) === ini_get_all('pcre', true)); + var_dump(ini_get_all($extension, false) === ini_get_all('pcre', false)); +} + +var_dump(ini_get_all('REFLECTION')); +var_dump(ini_get_all('Reflection', false)); + +var_dump(ini_get_all('NoSuchExtension')); +var_dump(ini_get_all('NoSuchExtension', false)); +?> +--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)

« previous php.cvs (#143726) next »