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

[8.x] Use getRealPath to ensure console command class names are generated correctly #34653

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

sailingdeveloper
Copy link
Contributor

@sailingdeveloper sailingdeveloper commented Oct 3, 2020

protected function commands()
{
    $this->load(__DIR__.'/../Commands');

    require base_path('routes/console.php');
}

When trying to register a new path in the Kernel class of your application to load console commands, and the path contains .., the classname isn't generated correctly in https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/Console/Kernel.php#L223-L227

By using getRealPath, the real path is resolved and the classname can be generated correctly.

When trying to register a new path in the `Kernel` class of your application, and the path contains `..`, the classname isn't generated correctly in https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/Console/Kernel.php#L223-L227

By using `getRealPath`, the real path is resolved and the classname can be generated correctly.
@sailingdeveloper sailingdeveloper changed the title [8.x] Use getRealPath to ensure class name is resolved [8.x] Use getRealPath to ensure class name is generated correctly Oct 3, 2020
@sailingdeveloper sailingdeveloper changed the title [8.x] Use getRealPath to ensure class name is generated correctly [8.x] Use getRealPath to ensure console command class names are generated correctly Oct 3, 2020
@sailingdeveloper sailingdeveloper marked this pull request as ready for review October 3, 2020 09:04
@sailingdeveloper
Copy link
Contributor Author

sailingdeveloper commented Oct 3, 2020

I wasn't able to find existing tests for this logic to amend, if anyone can point me there, that'd be great :)

@taylorotwell taylorotwell merged commit 45ccee4 into laravel:8.x Oct 5, 2020
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.

2 participants