Homestyx hydra
Diffusion hydra f45d6421a13c

Fix PHP 8.1 "strlen(null)" exception opening a File overlay (Lightbox comment…

Description

Fix PHP 8.1 "strlen(null)" exception opening a File overlay (Lightbox comment frame)

Summary:
The error was caused by the overlay lightbox, since it gives the possibility to share a comment on any file
in any general Remarkup text, but that comment textarea is indeed empty as default.

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.

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=97e163187418), phorge(head=T15498, ref.master=a25af8ccef69, ref.T15498=a25af8ccef69)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/files/controller/PhabricatorFileLightboxController.php:23]

Closes T15498

Test Plan: Visit a blog post with a file/image dropped in the content and click on the thumbnail. No error overlay dialog is displayed anymore.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15498

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

Details

Provenance
Andre KlapperAuthored on Jul 5 2023, 1:36 PM
sirocylPushed on Oct 16 2024, 5:49 AM
Parents
R1:9d512595c0e2: Fix PHP 8.1 DifferentialBranchField getBranchDescription strlen(null) error
Branches
Unknown
Tags
Unknown

Event Timeline