Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception rendering Task with empty custom date field
ClosedPublic

Authored by aklapper on Sep 4 2023, 16:37.

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.

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=df6c315ace5f, ref.customOAuthUrlencodeNull=c69b9749027f), phorge(head=master, ref.master=7868ab3754fa)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:14]

Closes T15632

Test Plan

Have a custom field with type=date defined in maniphest.custom-field-definitions and edit an existing Task changing something else, keeping that field as empty.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.Sep 4 2023, 16:37

Tested. Thanks!

sgtm

src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
27

✅ The revision is coherent with this line.

This revision is now accepted and ready to land.Sep 9 2023, 18:31
valerio.bozzolan retitled this revision from Fix PHP 8.1 "strlen(null)" exception rendering task with custom date field after adding project to Fix PHP 8.1 "strlen(null)" exception rendering Task with empty custom date field.