From 94d45de2f7dd6472486c20110f542a6e3e6a6565 Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Sat, 20 May 2023 14:27:06 +0200 Subject: [PATCH] Fix PHP 8.1 "ltrim(null)" exception which blocks adding additional user email address Summary: Since PHP 8.1, passing a null string to `ltrim(string $string)` is deprecated. Thus we make sure that `$request->getStr('email')` does not return null as default. Closes T15376 Test Plan: Applied this change, afterwards repeated the steps to add a new email address on `/settings/panel/email/`. This time, it's possible to close the "Verification Email Sent" and the page `/settings/panel/email/` renders and lists the new email address. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15376 Differential Revision: https://we.phorge.it/D25210 --- .../settings/panel/PhabricatorEmailAddressesSettingsPanel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php index 29d0506105..665bb42b2f 100644 --- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php @@ -172,7 +172,7 @@ final class PhabricatorEmailAddressesSettingsPanel $email = null; $errors = array(); if ($request->isDialogFormPost()) { - $email = trim($request->getStr('email')); + $email = trim($request->getStr('email', '')); if ($new == 'verify') { // The user clicked "Done" from the "an email has been sent" dialog.