@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+4 -4
+1 -1
src/applications/auth/constants/PhabricatorCookies.php
··· 89 89 // temporary and clearing it when users log out. 90 90 91 91 $value = $request->getCookie(self::COOKIE_CLIENTID); 92 - if (!strlen($value)) { 92 + if (!phutil_nonempty_string($value)) { 93 93 $request->setTemporaryCookie( 94 94 self::COOKIE_CLIENTID, 95 95 Filesystem::readRandomCharacters(16));
+1 -1
src/applications/auth/controller/PhabricatorAuthController.php
··· 282 282 $viewer, 283 283 PhabricatorAuthLoginMessageType::MESSAGEKEY); 284 284 285 - if (!strlen($text)) { 285 + if (!phutil_nonempty_string($text)) { 286 286 return null; 287 287 } 288 288
+2 -2
src/applications/auth/controller/PhabricatorAuthStartController.php
··· 98 98 } 99 99 100 100 $next_uri = $request->getStr('next'); 101 - if (!strlen($next_uri)) { 101 + if (!phutil_nonempty_string($next_uri)) { 102 102 if ($this->getDelegatingController()) { 103 103 // Only set a next URI from the request path if this controller was 104 104 // delegated to, which happens when a user tries to view a page which ··· 112 112 } 113 113 114 114 if (!$request->isFormPost()) { 115 - if (strlen($next_uri)) { 115 + if (phutil_nonempty_string($next_uri)) { 116 116 PhabricatorCookies::setNextURICookie($request, $next_uri); 117 117 } 118 118 PhabricatorCookies::setClientIDCookie($request);