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
Unknown Object (File)
Sat, May 4, 14:18
Unknown Object (File)
Sat, May 4, 14:18
Unknown Object (File)
Sat, May 4, 13:22
Unknown Object (File)
Sat, May 4, 12:33
Unknown Object (File)
Tue, Apr 30, 21:38
Unknown Object (File)
Tue, Apr 30, 21:38
Unknown Object (File)
Tue, Apr 30, 21:38
Unknown Object (File)
Tue, Apr 30, 17:01

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