Skip to content

ext/reflection: Use canonical spelling and preserve user-given case in error messages#22272

Open
jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:canonicalize-error-messages
Open

ext/reflection: Use canonical spelling and preserve user-given case in error messages#22272
jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:canonicalize-error-messages

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Extracted from #22260

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.

Fixes #22271

@jorgsowa jorgsowa changed the title Use canonical spelling and preserve user-given case in error messages ext/reflection: Use canonical spelling and preserve user-given case in error messages Jun 10, 2026
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.
@jorgsowa jorgsowa force-pushed the canonicalize-error-messages branch from 8478dc6 to c9f5702 Compare June 10, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid case in ReflectionClass::getProperty

1 participant