Problem/Motivation

Found with PHP 8.4 - when retain_revision_info is enabled, getRevisionLogMessage() can return null, which gets passed as a @message placeholder to t(). Html::escape() now strictly requires string, not null.

TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of /var/www/html/web/core/lib/Drupal/Component/Utility/Html.php).

Steps to reproduce

  • Run PHP 8.4
  • Enable "Retain revision authoring information"
  • Create new node as draft with no Revision message
  • Bulk publish that node to latest revision

Proposed resolution

$revision_message = (string) ($this->entity->getRevisionLogMessage() ?? ''); // ensures it is always a string

Remaining tasks

  1. Patch
  2. Review
  3. Commit
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

whthat created an issue. See original summary.

whthat’s picture

Status: Active » Needs review
joseph.olstad’s picture

https://git.drupalcode.org/project/moderated_content_bulk_publish/-/comm...

Next time, please use the commit message from the Contribution record suggested value.

joseph.olstad’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.