From 6e8733fba00a4fbd28f4cd9309d52aceeebc88af Mon Sep 17 00:00:00 2001 From: Philip Iezzi Date: Fri, 31 Mar 2023 16:25:57 +0200 Subject: [PATCH] fixed SendmailWrapper::stripStrLength() to also accept null value --- README.md | 4 ++-- app/SendmailWrapper.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 87a18ad..d61f52d 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ www-data ALL = (sendmailwrapper) NOPASSWD:/usr/sbin/sendmail-throttle [0- Add/modify the following in your php.ini: ```ini -sendmail_path = "/usr/sbin/sendmail-wrapper -t -i" +sendmail_path = /usr/sbin/sendmail-wrapper -t -i auto_prepend_file = /var/www/shared/prepend.php ``` @@ -169,7 +169,7 @@ If you stick with our default configuration, you need to update your `php.ini`: ```diff - sendmail_path = /usr/sbin/sendmail-wrapper -+ sendmail_path = "/usr/sbin/sendmail-wrapper -t -i" ++ sendmail_path = /usr/sbin/sendmail-wrapper -t -i ``` If you don't care about Symfony Mailer or any other mailer components that check for `-t` existence in `sendmail_path`, you can keep the old `php.ini` configuration and add this to your `config.local.ini`: diff --git a/app/SendmailWrapper.php b/app/SendmailWrapper.php index b24efa9..b42f7bc 100644 --- a/app/SendmailWrapper.php +++ b/app/SendmailWrapper.php @@ -168,9 +168,10 @@ public function run(): int /** * Limit a string to a specific length. */ - public function stripStrLength(string $value, int $limit = null, string $suffix = null): string + public function stripStrLength(?string $value, int $limit = null, string $suffix = null): string { - $limit = $limit ?? $this->conf->syslog->stringLengthLimit; + $value ??= ''; + $limit = $limit ?? $this->conf->syslog->stringLengthLimit; $suffix = $suffix ?? $this->conf->syslog->stringCutSuffix; $strLen = mb_strlen($value);