diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index c061c731ce6..f60371a68b8 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -254,7 +254,10 @@ public static function inferBasePath() { return match (true) { isset($_ENV['APP_BASE_PATH']) => $_ENV['APP_BASE_PATH'], - default => dirname(array_keys(ClassLoader::getRegisteredLoaders())[0]), + default => dirname(array_values(array_filter( + array_keys(ClassLoader::getRegisteredLoaders()), + fn ($path) => ! str_contains($path, '/vendor/'), + ))[0]), }; }