Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exceptions blocking account registration with custom OAuth provider after redirect
ClosedPublic

Authored by aklapper on Aug 5 2023, 20:42.
Tags
None
Referenced Files
F3308044: D25375.1743158655.diff
Thu, Mar 27, 10:44
F3307058: D25375.1743138151.diff
Thu, Mar 27, 05:02
F3306638: D25375.1743130291.diff
Thu, Mar 27, 02:51
F3305972: D25375.1743122912.diff
Thu, Mar 27, 00:48
F3305901: D25375.1743122203.diff
Thu, Mar 27, 00:36
F3303997: D25375.1743090394.diff
Wed, Mar 26, 15:46
F3303593: D25375.1743083650.diff
Wed, Mar 26, 13:54
F3296968: D25375.1742980232.diff
Tue, Mar 25, 09:10

Details

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.

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:70]
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/view/PhabricatorAuthAccountView.php:32]

Closes T15590

Test Plan

Phorge user account registration page "Create a New Account" at /auth/register/abcdefghijklmnopqrstuvwxyz0123456/ now renders as expected, instead of displaying errors only.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable