Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception[s] which blocks rendering External Editor user settings page
ClosedPublic

Authored by aklapper on Apr 30 2023, 18:00.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 04:15
Unknown Object (File)
Thu, Apr 11, 12:46
Unknown Object (File)
Thu, Apr 11, 00:04
Unknown Object (File)
Wed, Apr 10, 20:01
Unknown Object (File)
Sun, Apr 7, 10:18
Unknown Object (File)
Fri, Apr 5, 23:53
Unknown Object (File)
Wed, Apr 3, 07:08
Unknown Object (File)
Sun, Mar 31, 12:33

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.

Closes T15310

Test Plan

Applied this change (on top of D25144, D25145, D25146, D25147, D25151,
D25152, D25153) and /settings/panel/editor/ correctly rendered in web browser.

Diff Detail

Repository
rP Phorge
Branch
D25160 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 310
Build 310: arc lint + arc unit

Event Timeline

Thanks for this

Tested locally, everything is fine

yesyes

src/applications/settings/panel/PhabricatorExternalEditorSettingsPanel.php
42

✅ I tested this locally with phlog() and it seems the valid input domain of $pattern is just string - with values like "txmt://open/?url=file:///Users/alincoln/editor_links/%n/%f&line=%l", or a default to null.

The phutil_nonempty_string() will report alien types, and that is OK.

This revision is now accepted and ready to land.May 1 2023, 19:00