Page MenuHomePhorge

PHP 8.1 "trim(null)" exception when creating a diff with an empty "Differential Revision:" field
Open, Needs TriagePublic

Description

PHP 8.1.2; Phorge at b5140eed542a68bacb636c0f6fe73f85364b8094

Steps to reproduce:

  1. Create a commit with an empty "Differential Revision:" field. E.g.
Test commit

Summary: This is a test commit

Differential Revision:
  1. Run arc diff --trace
  2. See the following error:
[2024-06-27 09:52:26] EXCEPTION: (RuntimeException) trim(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), tmphutil()
  #0 PhutilErrorHandler::handleError(integer, string, string, integer)
  #1 trim(NULL) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2048]
  #2 ArcanistDiffWorkflow::parseCommitMessagesIntoFields(array) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:1872]
  #3 ArcanistDiffWorkflow::getDefaultCreateFields() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:1495]
  #4 ArcanistDiffWorkflow::getCommitMessageFromUser() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:1429]
  #5 ArcanistDiffWorkflow::buildCommitMessage() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:362]
  #6 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:427]