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:PHP-8.4from
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:PHP-8.4from
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
@jorgsowa jorgsowa force-pushed the canonicalize-error-messages branch from 8478dc6 to c9f5702 Compare June 10, 2026 17:59
@TimWolla

Copy link
Copy Markdown
Member

and autoloaders received it in lowercase, breaking case-sensitive (PSR-4) autoloaders.

Is this a bugfix then that should be applied to 8.4+?

jorgsowa added 2 commits June 12, 2026 00:43
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 108faa9 to 98649e7 Compare June 11, 2026 22:47
@jorgsowa jorgsowa changed the base branch from master to PHP-8.4 June 11, 2026 22:47
@jorgsowa

jorgsowa commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Is this a bugfix then that should be applied to 8.4+?

Changed the target branch to 8.4.

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.

ReflectionClass::getProperty silently turns property name into lowercase

2 participants