Skip to content

Commit

Permalink
[8.x] Use getRealPath to ensure class name is resolved (#34653)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sailingdeveloper authored Oct 5, 2020
1 parent ea3f1e3 commit 45ccee4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected function load($paths)
$command = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($command->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR)
Str::after($command->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR)
);

if (is_subclass_of($command, Command::class) &&
Expand Down

0 comments on commit 45ccee4

Please sign in to comment.