Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle preceeding slash in class name handling #239

Open
wants to merge 5 commits into
base: 4.x
Choose a base branch
from

Conversation

M1ke
Copy link

@M1ke M1ke commented Feb 1, 2022

Resolves #237

To summarise that issue:

  • PHP class names may be valid in both the format Foo\Bar and also as \Foo\Bar when used as a string
  • Using Foo::class returns Foo\Bar but legitimate user code may handle as \Foo\Bar and this would work for class_exists or new $var cases
  • Because of this, a concrete class may be set with one form of slash, and got with the other. This means the set definition is not used.
  • This fix adds test for both ways round that this issue could occur, and implements the class name normalizing in each appropriate place

This aims to be backwards compatible and causes no test failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preceeding slash confusing fully qualified class names
1 participant