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.
Tags
None
Referenced Files
F3319623: D25431.1743311903.diff
Sat, Mar 29, 05:18
F3315543: D25431.1743242058.diff
Fri, Mar 28, 09:54
F3311240: D25431.1743202929.diff
Thu, Mar 27, 23:02
F3306856: D25431.1743133489.diff
Thu, Mar 27, 03:44
F3306710: D25431.1743130820.diff
Thu, Mar 27, 03:00
F3306332: D25431.1743127143.diff
Thu, Mar 27, 01:59
F3304890: D25431.1743107397.diff
Wed, Mar 26, 20:29
F3300342: D25431.1743038077.diff
Wed, Mar 26, 01:14

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
Branch
T15632 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 829
Build 829: arc lint + arc unit

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.