Homestyx hydra
Diffusion hydra 226f3150933d

Fix PHP 8.1 "strlen(null)" exception creating Blueprint Working Copy

Description

Fix PHP 8.1 "strlen(null)" exception creating Blueprint Working Copy

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, however use phutil_nonempty_scalar() as the value might not necessarily be a string object.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_scalar() 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=788098096e11), phorge(head=arcpatch-D25239, ref.master=840a7fab2bc8, ref.arcpatch-D25239=870d62ce0ed9)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php:36]

Closes T15581

Test Plan:
Page Create Blueprint at /drydock/blueprint/edit/form/default/ renders as expected in web browser.

Try also creating a custom integer field and put some fuzzy data.

https://we.phorge.it/book/phorge/article/custom_fields/

Test these values:

  • 1 (stays as-is)
  • 0 (stays as-is)
  • 123.45 (becomes 123)
  • a "lizard" (becomes zero)
  • empty ("") (becomes empty)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15581

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

Details

Provenance
Andre KlapperAuthored on Aug 5 2023, 5:28 PM
sirocylPushed on Oct 16 2024, 5:49 AM
Parents
R1:39b576b145ae: Add HTML header for Atom/RSS discovery on Phame blog pages
Branches
Unknown
Tags
Unknown

Event Timeline