diff --git a/includes/common.inc b/includes/common.inc index 690c00478a..dc6720150b 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -8017,8 +8017,14 @@ function entity_extract_ids($entity_type, $entity) { $info = entity_get_info($entity_type); // Objects being created might not have id/vid yet. - $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL; - $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL; + if (!empty($info['entity keys'])) { + $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL; + $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL; + } + else { + $id = NULL; + $vid = NULL; + } if (!empty($info['entity keys']['bundle'])) { // Explicitly fail for malformed entities missing the bundle property.