Sometimes when entity module rebuild the entity the $entity->original property can get assigned FALSE.

$entity->original = !empty($existing_entities[$name]) ? $existing_entities[$name] : FALSE;

If this the case and entity_update is fired it means that the line
if (isset($entity->original)) {

evaluates to true and entity_extract_ids throws a entitymalformedexception.

Proposed fix to just add an extra is_object check to the conditional.

CommentFileSizeAuthor
search_api-entitymalformedexceptionfix.patch619 bytesACF

Comments

ACF created an issue. See original summary.

stan.ag’s picture

Issue summary: View changes

Got this error when deleting commerce products.

Why not simply change isset($entity->original) to !empty($entity->original) in conditional?

stan.ag’s picture

Issue summary: View changes

Restoring issue summary... :)

mbaynton’s picture

Issue tags: +Needs tests

Encountered this issue, confirmed the patch in the issue summary fixes it. If I were the maintainer I'd be calling for test coverage though.

drunken monkey’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Committed the fix with !empty() instead of isset(). Seems like poor code by the Entity API, though – but I guess just working around that is the best we can do.

  • drunken monkey committed 1f03fe1 on 7.x-1.x authored by ACF
    Issue #2550599 by ACF, drunken monkey: Fixed error on entity rebuilds.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.