Problem/Motivation

Now that #2730631: Upcast node and node_revision parameters of node revision routes is committed to core, deleting a revision via the revision overview no longer works in Drupal 9.3. The following error is shown:
Error: Object of class Drupal\node\Entity\Node could not be converted to string in Drupal\Core\Entity\EntityStorageBase->buildCacheId() (line 126 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Steps to reproduce

Go to the revision overview and try to delete a revision.

Proposed resolution

For now we should probably harden the code to allow more flexibility when deleting a revision.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

-

API changes

-

Data model changes

-

Comments

seanB created an issue. See original summary.

seanb’s picture

StatusFileSize
new1.81 KB

Patch is attached.

adriancid’s picture

Hi @seanB thanks for the issue and for the patch, I think is better to just add a restriction for the Drupal >= 9.3 in the module and use the new way, what do you think?

seanb’s picture

I thought about that, but there will be a transition period where it is perfectly fine to run either 9.2 or 9.3. Since supporting both versions is relatively easy, I would personally lean towards a (temporary) solution that supports both, and remove the extra code when 9.2 is deprecated. We could probably already create a followup issue and a MR and just postpone that issue for now.

eric_a’s picture

Status: Active » Needs review
Related issues: +#3202527: Error when trying to delete a revision
StatusFileSize
new1.61 KB

IMHO the simplest way to stay compatible with both <9.3 and ^9.3 in this case is leveraging RouteMatchInterface::getRawParameter(). Also, this way the "get ID from URL" comment remains accurate.

dunebl’s picture

#5 is doing the job... many thanks!

jjancel’s picture

Hello
here we go again new drupal revision 9.3.3 same error
when the correction will be integrated into the module

3cwebdev’s picture

Patch #5 works on D9.3.3.

gaards’s picture

StatusFileSize
new1.65 KB

Patch #5 doesn't apply to the current latest release 8.x-1.0-rc3 as the dev version has some changes around the same lines. I added a patch for those that need a patch compatible with 8.x-1.0-rc3.

jmoruzi’s picture

Patch #9 works on 8.x-1.0-rc3 on D9.3.7. Thanks.

eric_a’s picture

StatusFileSize
new691 bytes
new1.78 KB

Looking at the differences between #5 and the backport to 8.x-1.0-rc3 I suddenly realised that I had not removed the @todo comment.

Here's an update of #5, now with the removal of the @todo comment.
It won't apply to 8.x-1.0-rc3. Just use #9 for patching 8.x-1.0-rc3. (Thanks, @gaards!)

michelle-buckby’s picture

Patch #9 working great for my needs with 8.x-1.0-rc3

adriancid’s picture

Status: Needs review » Fixed

Thanks

  • adriancid committed 6934f30 on 8.x-1.x authored by Eric_A
    Issue #3249493 by Eric_A, seanB, gaards, adriancid, DuneBL, 3CWebDev,...
subir_ghosh’s picture

Patch #9 works. D 9.3.9 + 8.x-1.0-rc3

Status: Fixed » Closed (fixed)

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