1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Fix PHP 8.1 "strlen(null)" exception in PhabricatorMailSMTPAdapter when sending email

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/htdocs/phorge/phorge/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php:65]
```

Closes T15857

Test Plan: Send Welcome email via 'Manage' user screen and Run `./bin/phd log` afterwards to validate email action

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15857

Differential Revision: https://we.phorge.it/D25692
This commit is contained in:
Merula Turdus 2024-06-15 14:40:05 +02:00
parent 1bb7422662
commit 000bccf8e4

View file

@ -62,7 +62,7 @@ final class PhabricatorMailSMTPAdapter
$smtp->Host = $this->getOption('host');
$smtp->Port = $this->getOption('port');
$user = $this->getOption('user');
if (strlen($user)) {
if (phutil_nonempty_string($user)) {
$smtp->SMTPAuth = true;
$smtp->Username = $user;
$smtp->Password = $this->getOption('password');