3

I created a node called "Tutorial". When I preview the post before saving it, I received the following error:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7693 of /var/www/clients/client1/web2/web/includes/common.inc).

However, the error when submitting a blog (a node created by drupal) is different. Here it is:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1: SELECT nid FROM {node} WHERE uid = ; Array ( ) in eval() (line 10 of /var/www/clients/client1/web2/web/modules/php/php.module(80) : eval()'d code).

and

Notice: Trying to get property of non-object in eval() (line 8 of /var/www/clients/client1/web2/web/modules/php/php.module(80) : eval()'d code).

Any help please...

7
  • Looks like something seriously messed with your nodes. Is it clean Drupal installation? Can you identify when it started to fail, what changed then?
    – Mołot
    Commented Sep 12, 2013 at 10:12
  • It's not a clean installation. It came from version 5, then 6, then now version 7. I don't know what's the cause of this problem.
    – jaypabs
    Commented Sep 12, 2013 at 10:17
  • Please add that to your question, with information about the procedure you have used to migrate from 6 to 7. Was it OK in 7 for some time, or started just after migration?
    – Mołot
    Commented Sep 12, 2013 at 10:20
  • Sorry but I don't use the preview mode before. I just mentioned that it came from version 5 because you're asking if it was a clean installation.
    – jaypabs
    Commented Sep 12, 2013 at 12:21
  • 1
    Now I know the problem. It was the display suite module that is causing this problem. If I don't enable display suite under manage display >> layout, no error occur. Is there any fix on this?
    – jaypabs
    Commented Sep 12, 2013 at 14:55

5 Answers 5

2

I had similar issue. In my case I was using following line in node.tpl

$field = field_get_items('node', $node, 'field_foo');
$sponsored = field_view_value('node', $node, 'field_foo', $field[0]);

And field_foo was not in all content type. In Drupal 6 or 5 approach was different to get field values. That's why it was not happening.

Solution was:

if($node->type=='story'){
 $field = field_get_items('node', $node, 'field_foo');
 $sponsored = field_view_value('node', $node, 'field_foo', $field[0]);
}
1

In my case: file \includes\common.inc

function entity_extract_ids($entity_type, $entity) { ...

-  if (!empty($info['entity keys']['bundle'])) {
+  if (!empty($entity->{$info['entity keys']['bundle']})) {

fixing error.

3
  • 2
    1. DO NOT change Drupal core! 2. That line is already fixed in latest Drupal Commented Aug 11, 2015 at 11:51
  • Works for me, I do understand it is risky but this is the only thing which helps me at the moment. Up voted it back. Commented Nov 2, 2015 at 11:05
  • You sir, deserve a medal! This shit is not updated in 7.58. The code sucks, the bugs live forever, i'm looking for clues in bug reports that haven't been fixed in 6 - 7 years and are still open and active. You should definitly edit the core, make it work and go for an other CMS ASAP.
    – HerrWalter
    Commented Apr 24, 2018 at 21:14
0

Just want to share the solution on my problem.

I am using Display Suite and the error is caused by this line:

if (arg(0) == 'node') {

After changing it to this code:

if (arg(0) == 'node' && is_numeric(arg(1))) {

The error has gone.

0

Regarding your: EntityMalformedException it seems to me that it's to do with Drupal asking for information that is not available at the time.

I had this error when I had a view that was displaying fields from a node that didn't have those fields. I hadn't stipulated the content type that was to be viewed so Drupal assumed that it was all types and when if found a content type that didn't have the fields I wanted to display it crashed(!?) that page and displayed an error similar to yours.

It seems that it's been a persistent error that has not been resolved. I've noticed in the issue queue of many modules and much to the confusion of many people this error occurs.

0

You must see in the content type if the fields data type matches with the information type you save. I mean, if you have a field that is integer type you can't insert a text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.