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)
Wed, Mar 27, 22:11
Unknown Object (File)
Tue, Mar 26, 12:45
Unknown Object (File)
Tue, Mar 26, 11:34
Unknown Object (File)
Feb 25 2024, 07:36
Unknown Object (File)
Feb 25 2024, 07:35
Unknown Object (File)
Feb 25 2024, 06:54
Unknown Object (File)
Feb 25 2024, 06:47
Unknown Object (File)
Feb 11 2024, 23:17

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