Steps to reproduce:
1. Install standard profile and setup node_embed
2. Create an article and enter [[nid:123]] in the body
3. Visit front page

You'll get the following error:
Error
The website encountered an unexpected error. Please try again later.
Error message
Recoverable fatal error: Argument 1 passed to _node_embed_user_feedback() must be an instance of stdClass, boolean given, called in /home/sd9835342ceab247/www/sites/default/modules/node_embed/node_embed.module on line 73 and defined in _node_embed_user_feedback() (line 110 of /home/sd9835342ceab247/www/sites/default/modules/node_embed/node_embed.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

olli’s picture

Status: Active » Needs review
FileSize
464 bytes
Tess Bakker’s picture

Different patch, different approach.

With patch #1, content editors won't be notified of removed nodes on non-node-pages like frontpage/views page/batch.

With this patch a dsm is set and a small error is displayed instead of the replacement token. This is needed, because some modules will remove [[..]] -tokens from the text.

@maintainer: If there isn't the need for a message, patch #1 is the way to go.

nadavoid’s picture

Status: Needs review » Reviewed & tested by the community

I've tested #2 and it's working well for me. Thank you @Tessa Bakker!

kevincooper’s picture

I have also tested #2 and it seems to be working.

szeidler’s picture

Patch #2 is working fine for me. I'm wondering if a non successfully loaded not, should not stack up at all, instead of catching it in the user feedback as #2 is doing it.

My approach would be something like this.

// Add the node page to the stack.
if (empty($stack) && $node_page = menu_get_object('node')) {
    // Only successfully loaded nodes should be stacked up.
    if (is_object($node_page)) {
      $stack[$node_page->nid] = $node_page;
    }
  }

The issue itself is really important to fix, as it can happen with every invalid node id in the token or the more relevant case, that the referenced node got deleted. Also then you would see the fatal error.

paulvandenburg’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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