Revision object is returned instead of revision id due to core type upcasting change.

Created on 12 September 2023, 10 months ago
Updated 21 June 2024, 8 days 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 636 of core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

Steps to reproduce

  1. Install the module
  2. Create a node with revisions
  3. 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

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India sahilgidwani Jaipur

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

Comments & Activities

  • Issue created by @sahilgidwani
  • Status changed to Needs review 10 months ago
  • Issue was unassigned.
  • 🇨🇦Canada franceslui

    @sahilgidwani Thank you for submitting the patch in your comment #2. I have reviewed it and found that it worked correctly.

    Since node_revision_load is deprecated in Drupal 10.1.0 and will be removed in Drupal 11.0.0, I have submitted a new patch that uses \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.

  • Status changed to RTBC 8 days ago
  • 🇨🇦Canada joelpittet Vancouver

    Thank you both, this issue is indeed major as it is a WSOD for content editors. I have reviewed the patches and tested it out and it works well.

Production build 0.69.0 2024