mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Fix PHP 8.1 "strlen(null)" exceptions which block rendering Log In page after user logout
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. Note: this may highlight other absurd input values that might be worth correcting instead of just ignoring. If phutil_nonempty_string() throws an exception in your instance, report it to Phorge to evaluate and fix that specific corner case. Closes T15384 Test Plan: Applied these four changes; logged in again; logged out again; finally saw "Log In" page with "Username or Email" and "Password" field on `/auth/loggedout/` rendered in web browser. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15384 Differential Revision: https://we.phorge.it/D25217
This commit is contained in:
parent
3a3112f67b
commit
4d1adf6939
3 changed files with 4 additions and 4 deletions
|
@ -89,7 +89,7 @@ final class PhabricatorCookies extends Phobject {
|
|||
// temporary and clearing it when users log out.
|
||||
|
||||
$value = $request->getCookie(self::COOKIE_CLIENTID);
|
||||
if (!strlen($value)) {
|
||||
if (!phutil_nonempty_string($value)) {
|
||||
$request->setTemporaryCookie(
|
||||
self::COOKIE_CLIENTID,
|
||||
Filesystem::readRandomCharacters(16));
|
||||
|
|
|
@ -282,7 +282,7 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
|||
$viewer,
|
||||
PhabricatorAuthLoginMessageType::MESSAGEKEY);
|
||||
|
||||
if (!strlen($text)) {
|
||||
if (!phutil_nonempty_string($text)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
$next_uri = $request->getStr('next');
|
||||
if (!strlen($next_uri)) {
|
||||
if (!phutil_nonempty_string($next_uri)) {
|
||||
if ($this->getDelegatingController()) {
|
||||
// Only set a next URI from the request path if this controller was
|
||||
// delegated to, which happens when a user tries to view a page which
|
||||
|
@ -112,7 +112,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
if (strlen($next_uri)) {
|
||||
if (phutil_nonempty_string($next_uri)) {
|
||||
PhabricatorCookies::setNextURICookie($request, $next_uri);
|
||||
}
|
||||
PhabricatorCookies::setClientIDCookie($request);
|
||||
|
|
Loading…
Reference in a new issue