From 4e7ee37b3f564905a5cd2b40f505c573d0a9b8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com> Date: Sat, 13 Jul 2024 20:44:54 +0800 Subject: [PATCH] Fixed bug that restart failed when don't have `.env`. (#6949) --- src/Listener/ReloadDotenvListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Listener/ReloadDotenvListener.php b/src/Listener/ReloadDotenvListener.php index b9acd5c..2478c62 100644 --- a/src/Listener/ReloadDotenvListener.php +++ b/src/Listener/ReloadDotenvListener.php @@ -35,8 +35,10 @@ public function process(object $event): void $this->reloadDotenv(); } - protected function reloadDotenv(): void + private function reloadDotenv(): void { - DotenvManager::reload([BASE_PATH]); + if (file_exists(BASE_PATH . '/.env')) { + DotenvManager::reload([BASE_PATH]); + } } }