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
F2946743: D25375.1738413861.diff
Fri, Jan 31, 12:44
F2945565: D25375.1738331613.diff
Thu, Jan 30, 13:53
F2938170: D25375.1737976059.diff
Sun, Jan 26, 11:07
F2933168: D25375.1737752466.diff
Thu, Jan 23, 21:01
F2913834: D25375.1737431979.diff
Mon, Jan 20, 03:59
F2913833: D25375.1737431978.diff
Mon, Jan 20, 03:59
F2908461: D25375.1737378931.diff
Sun, Jan 19, 13:15
F2904974: D25375.1737337895.diff
Sun, Jan 19, 01:51

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
Branch
customOAuthTwitterDenied (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 729
Build 729: arc lint + arc unit