Error on node revision route due to core type upcasting change

Created on 23 May 2022, over 2 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

Drupal core 9.3 updated the typecasting for the node_revision β†’ route parameter which means it's a fully fledged object now. The code in this module for getting the entity is using code that thinks it's the revision id, a numeric value, which then throw this error:

TypeError: Illegal offset type in Drupal\Core\Entity\ContentEntityStorageBase->loadRevision() (line 639 of /var/www/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php)
#0 /var/www/docroot/modules/contrib/fieldblock/src/Plugin/Block/FieldBlock.php(461): Drupal\Core\Entity\ContentEntityStorageBase->loadRevision(Object(Drupal\node\Entity\Node))

Steps to reproduce

  • Install the module
  • Create a node with revisions
  • Click on the Revisions tab, click to view one of the revisions, observe WSOD

Proposed resolution

See attached patch.

Remaining tasks

User testing

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nsciacca

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024