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
Patch- Review
- Commit
Issue fork moderated_content_bulk_publish-3584593
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
Comment #3
whthat commentedComment #4
joseph.olstadhttps://git.drupalcode.org/project/moderated_content_bulk_publish/-/comm...
Next time, please use the commit message from the Contribution record suggested value.
Comment #5
joseph.olstadComment #7
joseph.olstadhttps://www.drupal.org/project/moderated_content_bulk_publish/releases/2...