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
F2993157: D25375.1740274318.diff
Sat, Feb 22, 01:31
F2993156: D25375.1740274315.diff
Sat, Feb 22, 01:31
F2992544: D25375.1740228495.diff
Fri, Feb 21, 12:48
F2987314: D25375.1740112538.diff
Thu, Feb 20, 04:35
F2982606: D25375.1739963404.diff
Tue, Feb 18, 11:10
F2982605: D25375.1739963404.diff
Tue, Feb 18, 11:10
F2982431: D25375.1739959922.diff
Tue, Feb 18, 10:12
F2979332: D25375.1739838102.diff
Mon, Feb 17, 00:21

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