From 6694ebc97b42e77c4c823753c6a7e4938b187000 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Thu, 9 Jan 2025 14:30:45 -0600 Subject: [PATCH] fix: filter vendor paths from registered loaders in Application::inferBasePath (#54119) --- src/Illuminate/Foundation/Application.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index c061c731ce69..f60371a68b84 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]), }; }