Skip to content

ReflectionClass::getProperty silently turns property name into lowercase #22271

@jorgsowa

Description

@jorgsowa

Description

The following code:

<?php
class C {
    public $p;
}

spl_autoload_register(function ($name) {
    echo "Autoloading $name\n";
});

$rc = new ReflectionClass('C');
try {
    $rc->getProperty("Some\\MixedCase::p");
} catch (ReflectionException $e) {
    echo $e->getMessage(), "\n";
}

Resulted in this output:

Autoloading some\mixedcase
Class "some\mixedcase" does not exist

But I expected this output instead:

Autoloading Some\MixedCase
Class "Some\MixedCase" does not exist

PHP Version

master

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions