0

The Message module was working fine but I noticed one of the messages wasn't getting created by Rules. I suspect it's due to locale being enabled recently and creating with the UI gives this error.

For message types where I haven't created a different language, it seems to work fine.

2 errors in log:

Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 219 of /usr/share/nginx/html/sites/all/modules/entity/includes/entity.controller.inc).

.

EntityMalformedException: Missing bundle property on entity of type message. in entity_extract_ids() (line 7930 of /usr/share/nginx/html/includes/common.inc).

The relevant lines in common.inc are:

// Explicitly fail for malformed entities missing the bundle property.
    if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
        dpm($info);// My dpm
      throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
    }

You can see where I added dpm(). $entity is empty but $info gives the below screenshot.

Any pointers for someone who just isn't used to debugging things like this? I've deleted every message in on the site with VBO but the error persists.

After two and half years of dev, this site was supposed to go into a proper beta next week in a friend's business but the entire UI relies on the Message module. :/

enter image description here

And here is a dpm of the ids for the flipping error.

enter image description here

Any help appreciated. I didn't expect it to all fall apart this weekend.

Edit: Closed as it is indeed a duplicate. I don't have the skills to deal with it so will just rewrite to use node functionality instead.

Edit 2: Calmed my head today and looked at things that weren't my own code. Turns out it was the Reply module which I use on Message. Reinstalling it gets rid of the errors. I don't know why it happened. It's been a part of Message for like a year during development.

  • Yeah, I'm going to dig through that tomorrow. But I was wondering if there is something in the above screenshots that could give me an indicator of where to start. I don't know what to look for. – Niall Murphy Jul 21 '17 at 16:40
  • This is a fairly generic and broad error. You will have to start with kenorbs answer and go from there. – Kevin Jul 21 '17 at 17:00
  • Nope. dd(debug_backtrace()); gave me a 24k line text file of which I know absolutely nothing about. This is a Message/Entity problem and it's far easier for me to recode the site to use nodes instead of messages. It'll take a few days because there's 10k+ lines of code written around Message but at least I'll know what I'm doing. This is a typical example of trusting third party modules gone wrong. – Niall Murphy Jul 21 '17 at 17:26
  • Fixed by reinstalling the Reply module. No idea how or why. – Niall Murphy Jul 22 '17 at 4:28
1

Exception EntityMalformedException is triggered, because (as you mentioned) your $entity is empty, and based on $info['entity keys']['bundle'] Entity module expects to have $entity->type property, but it doesn't exist.

You should check the backtrace and find which module is responsible for this invalid call, e.g. by adding this line instead of dpm:

var_dump(debug_backtrace()); exit; // Show the backtrace and exit.

in order to identify and fix the broken code. The most relevant part from the backtrace is function which is called, so starting from the top [0]=>, then [1]=>, so once you find the custom code or contrib module responsible for this exception. If there is no custom module apart of messages module, you should report this bug to the maintainer of this module.

Here is the related bug: Fatal errors when content types are deleted before messages are.


For further explanation, check: How to debug EntityMalformedException?

| improve this answer | |
  • Thanks for the help but the text file that dd(debug_backtrace()); gave me is total jibberish and is enormous. I'm going to spend next week rewriting the site to just use nodes for its activity system. I'm not a web developer by trade and no one is paying me to deal with it. – Niall Murphy Jul 21 '17 at 17:26
  • When using debug_backtrace, check for main array keys and which functions are called, [1] for the parent function, [2] for the 2nd deep call, the broken code should be around 3-5. Or just look for function string and start from there. – kenorb Jul 21 '17 at 17:29
  • Even then, I won't know what to do. If the screenshots above give no indication of where to start, there's no point in me trying. I know my limits. Thanks again. – Niall Murphy Jul 21 '17 at 17:32
  • @NiallMurphy If it's related to Messages module, probably it is the bug as per this report: Fatal errors when content types are deleted before messages are. If it's not, report a new one. – kenorb Jul 21 '17 at 17:33
  • 1
    Fixed by reinstalling the Reply module. No idea how or why. Just happy. – Niall Murphy Jul 22 '17 at 4:28

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