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
F3295465: D25160.1742954954.diff
Tue, Mar 25, 02:09
F3291028: D25160.1742876191.diff
Mon, Mar 24, 04:16
F3289932: D25160.1742855348.diff
Sun, Mar 23, 22:29
F3284799: D25160.1742786228.diff
Sun, Mar 23, 03:17
F3251990: D25160.1742385835.diff
Tue, Mar 18, 12:03
F3245746: D25160.1742192151.diff
Sun, Mar 16, 06:15
F3224921: D25160.1742089663.diff
Sat, Mar 15, 01:47
F3223622: D25160.1741989379.diff
Thu, Mar 13, 21:56

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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