Problem/Motivation

When trying to access a route that doesn't exist, the following edge-case can happen:

Error: Call to a member function label() on string in editoria11y_page_attachments() (line 248 of /web/modules/contrib/editoria11y/editoria11y.module).
#0 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(315): editoria11y_page_attachments()

For me, this happened when trying to access:
https://www.example.com/user/1234/orders/56789

AFTER deleting the user with id 1234 - so that route isn't valid any more. Instead of a 404 or something like that, this error appeared.

I'm pretty sure this is an edge-case, but it should be solved.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

anybody created an issue. See original summary.

itmaybejj’s picture

Assigned: Unassigned » itmaybejj

  • itmaybejj committed 000c3eaf on 3.0.x-dev
    fix: #3566084 Error: Call to a member function label() on string in...

  • itmaybejj committed 399f0211 on 2.2.x-dev
    fix: #3566084 Error: Call to a member function label() on string in...

  • itmaybejj committed 4040d374 on 3.0.x-dev
    fix: #3566084 Error: Call to a member function label() on string in...
itmaybejj’s picture

It is an edge case and not something I can reproduce in a vanilla install.......but mapping all these strings for the page attachment requires using so, so many entity-type-specific class calls that someone finds a new edge case at least once a year.

I'll keep fixing them whenever I can reproduce them, but at the least it's time to wrap this part of the code in a big old try/catch block to reduce edge-case-problems to logger warnings rather than site crashes.

3.x will also add dashboard maintenance scripts to identify and remove or update URLs for old records. That should help on sites that have been running for a while.

itmaybejj’s picture

Status: Active » Needs review
anybody’s picture

Thanks for the fixes @itmaybejj! I'm not really able to review the many changes, but I think you know what you're doing. :)

agoradesign’s picture

Status: Needs review » Reviewed & tested by the community

This happened to me on a commerce order page as well, but the customer user entity wasn't deleted at all

Patched 2.2.19 with the commit above, works for me :)

anybody’s picture

NICE @agoradesign even better!! 🎉🥳

  • itmaybejj committed 399f0211 on 2.2.x
    fix: #3566084 Error: Call to a member function label() on string in...
itmaybejj’s picture

Status: Reviewed & tested by the community » Fixed

Splendid. 2.2.20 tagged.

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.

  • itmaybejj committed 4040d374 on 3.0.x
    fix: #3566084 Error: Call to a member function label() on string in...

  • itmaybejj committed 000c3eaf on 3.0.x
    fix: #3566084 Error: Call to a member function label() on string in...

Status: Fixed » Closed (fixed)

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