From 2e4d0c61241d4a76d70c6b43ca159ad5da1098ce Mon Sep 17 00:00:00 2001 From: Oliver Bartsch Date: Fri, 28 Oct 2022 10:32:51 +0200 Subject: [PATCH 1/2] [BUGFIX] Prevent TypeError on passing env var --- .gitignore | 1 + src/Config.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9216ae1..a9d7dd0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /var/ /vendor/ /.php-cs-fixer.cache +/.idea diff --git a/src/Config.php b/src/Config.php index 9fa58a6..d80b075 100644 --- a/src/Config.php +++ b/src/Config.php @@ -215,7 +215,7 @@ public function useDDEVConfiguration(string $dbHost = null): self ] ) ->useImageMagick() - ->useMailhog(getenv('MH_SMTP_BIND_ADDR')); + ->useMailhog((string)getenv('MH_SMTP_BIND_ADDR')); return $this; } From 79d8d2dd45a9c65eaf52a87fa83dbf1892f9132a Mon Sep 17 00:00:00 2001 From: Oliver Bartsch Date: Fri, 28 Oct 2022 14:17:28 +0200 Subject: [PATCH 2/2] [TASK] Check env before activating mailhog --- src/Config.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Config.php b/src/Config.php index d80b075..74e47b5 100644 --- a/src/Config.php +++ b/src/Config.php @@ -214,8 +214,13 @@ public function useDDEVConfiguration(string $dbHost = null): self 'user' => 'db', ] ) - ->useImageMagick() - ->useMailhog((string)getenv('MH_SMTP_BIND_ADDR')); + ->useImageMagick(); + + $mailhogSmtpBindAddr = getenv('MH_SMTP_BIND_ADDR'); + if (is_string($mailhogSmtpBindAddr) && $mailhogSmtpBindAddr !== '') { + $this->useMailhog($mailhogSmtpBindAddr); + } + return $this; }