EntityMalformedException: Missing bundle property on entity of type node in entity_extract_ids() line 7929

Created on 18 December 2017, almost 7 years ago
Updated 17 April 2024, 5 months ago

I have a content type with a file field. I have a custom module which implements hook_form_alter() which adds an extra submission handler to the node edit form.

    $form['actions']['submit']['#submit'][] = 'anexar_aplicacion_submit'; 
function anexar_applicayion_submit(&$form, &$form_state) {
  $reto_nid = $form_state['values']['reto_nid'];
  $aplicacion_nid = $form_state['node']->nid;

  $reto = node_load($reto_nid);
  $reto->field_aplicaciones[LANGUAGE_NONE][]['target_id'] = $aplicacion_nid;
  field_attach_update('node', $reto);
  field_attach_presave('node', $reto);
  entity_get_controller('node')->resetCache(array($reto->nid));
}

This exception is thrown when I create a node of this content type, with the file. It is not thrown when the file is not attached to the node.

EntityMalformedException: Missing bundle property on entity of type node in entity_extract_ids() line 7929

🐛 Bug report
Status

Needs work

Version

7.0 ⚰️

Component
Base 

Last updated 10 minutes ago

Created by

🇨🇴Colombia Augusto182

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇭🇺Hungary danyg Budapest

    Without the updated patch in #20, I still got the following PHP error:
    EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 8090 of /app/docroot/includes/common.inc).

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    2,159 pass, 1 fail
  • @florisg opened merge request.
  • 🇳🇱Netherlands florisg

    This bug has been around for ages, please merge it while we still support Drupal 7
    I merely rerolled #20 against 7.98

  • 🇳🇱Netherlands florisg

    updated title to correspond with exact line in v7.98
    so people who search with google can find the solution

  • 🇸🇰Slovakia poker10

    @florisg The last merge request(s) are failing tests. So it is not possible to use this patch without additional changes - we need to fix the test failure and then we can consider the next steps (see my comment #17). Thanks!

    Anyway, thanks for working on this, but I suppose that the new merge request was not needed, as there is an open merge request from @Liam Morland, which is the same and therefore this one should have been rerolled.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    2,159 pass, 1 fail
  • Issue was unassigned.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    It seems the issue summary has been lost in one of the previous revisions.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024