HomePhorge

Fix PHP 8.1 "strlen(null)" exception trying to create an empty Menu Item

Description

Fix PHP 8.1 "strlen(null)" exception trying to create an empty Menu Item

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 T15398

Test Plan:
Applied this change and "Edit Menu Item" overlay dialog correctly shows "You must choose a project" resp. "You must choose a room." error message, now without an exception.

Go to /home/menu/configure/custom/ and also to /home/menu/configure/global/ and try:

  • Add Label with name 0 / 1 / 1.123 etc.
  • Add Label, Save again
  • Add Link, Save again
  • Add Application, Save again
  • Add Divider, Save again
  • Add Conpherence, Save again
  • Add Link, Save Again
  • Add Motivator (Cat Facts), Save again
  • Add Form, Save again
  • Order Items
  • Activate/Disable Built-in Home (unrelated)
  • Remove all the above

Also, tried on a Project menu.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15398

Differential Revision: https://we.phorge.it/D25230

Details

Provenance
Andre KlapperAuthored on May 23 2023, 2:59 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP19d9da7feae9: Fix PHP 8.1 "strlen(null)" exception which blocks Working Copy blueprint…
Branches
Unknown
Tags
Unknown

Event Timeline