Commit f75ae843fcd for php.net

commit f75ae843fcd9f9e9ad6716ef3f3f85b2bfd1ac92
Author: Jorg Adam Sowa <jorg.sowa@gmail.com>
Date:   Sun Jun 14 19:12:16 2026 +0200

    Preserve class-name case in ReflectionClass::getProperty() (#22272)

    When given a "Class::property" argument, getProperty() lowercased the
    class part before looking it up, so the "Class ... does not exist"
    exception printed the lowercased name and autoloaders received it in
    lowercase, breaking case-sensitive (PSR-4) autoloaders.

    Pass the class name to zend_lookup_class() as given - it lowercases
    internally for the class-table lookup - matching what ReflectionMethod
    and ReflectionProperty already do.

diff --git a/NEWS b/NEWS
index 7b36fb24679..3ac671dda65 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,10 @@ PHP                                                                        NEWS
     Phar::addEmptyDir() for paths starting with "/.phar", while allowing
     non-magic directory names that merely share the ".phar" prefix. (Weilin Du)

+- Reflection:
+  . Preserve class-name case in ReflectionClass::getProperty() error messages
+    and autoloading. (jorgsowa)
+
 - Sqlite:
   . Fix error checks for column retrieval. (ndossche)

diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index e718b1815fb..1f5b448f85f 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4734,9 +4734,7 @@ ZEND_METHOD(ReflectionClass, getProperty)
 	str_name = ZSTR_VAL(name);
 	if ((tmp = strstr(ZSTR_VAL(name), "::")) != NULL) {
 		classname_len = tmp - ZSTR_VAL(name);
-		classname = zend_string_alloc(classname_len, 0);
-		zend_str_tolower_copy(ZSTR_VAL(classname), ZSTR_VAL(name), classname_len);
-		ZSTR_VAL(classname)[classname_len] = '\0';
+		classname = zend_string_init(ZSTR_VAL(name), classname_len, 0);
 		str_name_len = ZSTR_LEN(name) - (classname_len + 2);
 		str_name = tmp + 2;

diff --git a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
index c47f9e4fffd..8be2f4bf85b 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
@@ -244,4 +244,4 @@ function showInfo($name) {
 --- (Reflecting on X::doesNotExist) ---
 Fully qualified property name X::$doesNotExist does not specify a base class of C
 --- (Reflecting on doesNotexist::doesNotExist) ---
-Class "doesnotexist" does not exist
+Class "doesNotexist" does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
index 32e2d7876f6..6a4f44ee597 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
@@ -248,4 +248,4 @@ function showInfo($name) {
 --- (Reflecting on X::doesNotExist) ---
 Fully qualified property name X::$doesNotExist does not specify a base class of C
 --- (Reflecting on doesNotexist::doesNotExist) ---
-Class "doesnotexist" does not exist
+Class "doesNotexist" does not exist
diff --git a/tests/classes/autoload_016.phpt b/tests/classes/autoload_016.phpt
index 13454d018cd..c6e7a2b3768 100644
--- a/tests/classes/autoload_016.phpt
+++ b/tests/classes/autoload_016.phpt
@@ -16,5 +16,5 @@
 }
 ?>
 --EXPECT--
-In autoload: string(6) "undefc"
-Class "undefc" does not exist
+In autoload: string(6) "UndefC"
+Class "UndefC" does not exist