PHP error notice displayed when tried to edit a language version of node.

screenshot

Steps to reproduce this issue:

  1. Install fresh D8;
  2. Enable Content Translation module;
  3. Edit article content type;
  4. Enable translation under language settings;
  5. Edit article content type, click manage fields;
  6. Edit body;
  7. Enable translation for body field;
  8. In configuration, add languages;
  9. Create test article;
  10. Click translations tab;
  11. Add other language versions for the node;
  12. Click 'edit' to edit existing version of translations (Not the original copy);

The error notice will display as screenshot.

Line 135 in node module is trying to get node->type. This error displayed because the node didn't get loaded, as arg[1] is 'node' instead of nid.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rli’s picture

Issue summary: View changes

Giving the steps to reproduce the issue.

rli’s picture

Assigned: Unassigned » rli
rli’s picture

Component: translation_entity.module » language.module

Move to language module as the langcode is added into menu in language module.

rli’s picture

Assigned: rli » Unassigned

Been frustrating about this. What's the point putting langcode in the menu e.g af /node/edit ? That is not doing anything unless we have translation_entity installed. And it made node_help confused.

mradcliffe’s picture

Title: Trying to get property of non-object in node_help() (line 135 of core/modules/node/node.module) » menu_get_active_help() does not support language arguments for node_edit router path
Component: language.module » language system
Priority: Normal » Major
Status: Active » Needs review
Issue tags: +PostgreSQL, +Needs issue summary update, +Testbot environments
FileSize
41.42 KB

Drupal\system\Plugin\Block\SystemHelpBlock->access() calls menu_get_active_help(), which sends in the incorrect arguments to hook_help for the node edit router path or the incorrect router path for the language arguments. node_help() loads the node entity ONLY to get the node type so that it can display the content type help (submission guidelines).

The query that is built contains a data type mismatch, which is not allowed in Postgresql.

Semi-related issues:

- #2056627: Form API autocomplete is broken for routes
- #244090: Tie help into menu router

Possible resolutions:

- Get rid of hook_help(), one of the last remaining hooks from Drupal 3. :*(
- Language, menu, or help should normalize arguments before passing in to hook_help implementation.
- Find a different way of getting the node type in node_help.

The easiest resolution is to pass the current path as the second parameter in arg(), which is what the one-line patch does.

Tests:

- A unit test that tests drupal_help_arg() output?

mradcliffe’s picture

Crap. git diff origin/8.x from the wrong branch so it pulled in a bunch of other things that I committed from other postgres issues.

tim.plunkett’s picture

Issue tags: +Needs tests

Nice find, needs tests

Berdir’s picture

mradcliffe’s picture

Status: Needs review » Closed (duplicate)

Forgot to do this a while ago.

mradcliffe’s picture

Issue summary: View changes

fixing typo