diff --git a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index a1bc7460aa36..2fa429f83034 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -93,7 +93,7 @@ protected function loadConfigurationFiles(Application $app, RepositoryContract $ */ protected function loadConfigurationFile(RepositoryContract $repository, $name, $path, array $base) { - $config = require $path; + $config = (fn () => require $path)(); if (isset($base[$name])) { $config = array_merge($base[$name], $config); diff --git a/tests/Foundation/Bootstrap/LoadConfigurationTest.php b/tests/Foundation/Bootstrap/LoadConfigurationTest.php index 3ab29da410c6..f8d3f387c1d2 100644 --- a/tests/Foundation/Bootstrap/LoadConfigurationTest.php +++ b/tests/Foundation/Bootstrap/LoadConfigurationTest.php @@ -26,4 +26,15 @@ public function testDontLoadBaseConfiguration() $this->assertNull($app['config']['app.name']); } + + public function testLoadsConfigurationInIsolation() + { + $app = new Application(__DIR__.'/../fixtures'); + $app->useConfigPath(__DIR__.'/../fixtures/config'); + + (new LoadConfiguration())->bootstrap($app); + + $this->assertNull($app['config']['bar.foo']); + $this->assertSame('bar', $app['config']['custom.foo']); + } } diff --git a/tests/Foundation/fixtures/config/custom.php b/tests/Foundation/fixtures/config/custom.php new file mode 100644 index 000000000000..e07153f0cae1 --- /dev/null +++ b/tests/Foundation/fixtures/config/custom.php @@ -0,0 +1,7 @@ + $name, +];