This is a bug when menu_link module is active.

On a Content-type with menu_link field, create a node with some content on fields (or just body).
After saving it, you are redirect on the node display, but no fields display. Debugging node and entity show entity is not build completely (fields are empty).

Debugging redirect module, i see problem come from entity_load call on redirect_load_entity_from_path function which is called on redirect_url_inbound_alter.

The strange part : redirect_load_entity_from_path is called but not used. So i think this code should be deleted (line 217).

// Redirect from default entity paths to the proper entity path.
    if ($path_entity = redirect_load_entity_from_path($path)) {
      if ($uri = entity_uri($path_entity['entity_type'], $path_entity['entity'])) {
        if ($path != $uri['path']) {
          //return redirect_redirect(array('redirect' => $uri['path'], 'redirect_options' => $uri['options'], 'type' => 'global'));
        }
      }
    }

Comments

klaasvw’s picture

Title: Incompatibility with menu_link module. Empty entity on insert » Entity_load during url_inbound_alter is incompatible with text fields
StatusFileSize
new1.1 KB

Renaming the title to better reflect the issue (it's not related to menu link module only).

I also encountered this with a custom filter that uses a theming function to generate its output. Because theme was called the theme layer was initialized without calling hook_custom_theme. In combination with a theme switching module (in my case domain_theme) the default theme is used after a cache clear instead of the one defined in a hook_custom_theme implementation.

The problem is indeed the entity_load call in redirect_url_inbound_alter. hook_url_inbound_alter is called very early in the bootstrap causing entity_load to behave unexpectedly.

Because the code in redirect_url_inbound_alter is just a stub I'm suggesting to remove it for now. In the meantime we could look for a better solution in #905914: Merge global redirect functions into Redirect module that doesn't use entity_load.

klaasvw’s picture

Status: Active » Needs review
alan d.’s picture

Status: Needs review » Closed (duplicate)