Commit 46da0fda907 for php
commit 46da0fda907d44ca1705f682a286722e8966ef29
Author: Weilin Du <weilindu@php.net>
Date: Mon Nov 16 13:23:56 2026 +0800
[RFC] Implement case-insensitive extension names in ini_get_all() (#25448)
This implement RFC: https://wiki.php.net/rfc/case_insensitive_ini_get_all
diff --git a/NEWS b/NEWS
index 94d00d96dff..f8baf0e8807 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 d9242ecb3c1..4f9c0176590 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 db302ab724a..9ae99b6f1ee 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 00000000000..fe1cd3350e1
--- /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)