Skip to content

Commit

Permalink
fixed SendmailWrapper::stripStrLength() to also accept null value
Browse files Browse the repository at this point in the history
  • Loading branch information
onlime committed Mar 31, 2023
1 parent 7411809 commit 6e8733f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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`:
Expand Down
5 changes: 3 additions & 2 deletions app/SendmailWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6e8733f

Please sign in to comment.