Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception on "Link External Account" page at login
ClosedPublic

Authored by aklapper on Aug 16 2023, 11:12.
Tags
None
Referenced Files
F1448079: D25395.id.diff
Wed, Feb 28, 14:49
F1432438: D25395.diff
Tue, Feb 27, 17:21
Unknown Object (File)
Fri, Feb 23, 15:41
Unknown Object (File)
Fri, Feb 23, 14:33
Unknown Object (File)
Fri, Feb 23, 13:27
Unknown Object (File)
Fri, Feb 23, 09:03
Unknown Object (File)
Jan 27 2024, 12:49
Unknown Object (File)
Jan 27 2024, 07:19

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(), phorge()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/controller/PhabricatorAuthSetExternalController.php:43]

Closes T15606

Test Plan

Follow steps in T15606; page /auth/external/ displays as expected the content: "Link External Account - You can link your Phabricator account to an external account to allow you to log in more easily in the future. To continue, choose an account to link below. If you prefer not to link your account, you can skip this step." and the "Link External Account" button.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

avivey subscribed.

One day, we'd like pht() to return an object (non-string), but we'll handle that when we get there I guess.

This revision is now accepted and ready to land.Aug 16 2023, 12:47