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)
Sun, Jul 14, 05:57
Unknown Object (File)
Sun, Jul 14, 05:56
Unknown Object (File)
Sun, Jul 14, 05:56
Unknown Object (File)
Sun, Jul 14, 00:55
Unknown Object (File)
Sat, Jul 13, 02:53
Unknown Object (File)
Wed, Jul 10, 07:49
Unknown Object (File)
Mon, Jul 8, 23:10
Unknown Object (File)
Mon, Jul 8, 22:51

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