diff --git a/includes/common.inc b/includes/common.inc index e4b4882f01..4b8ebd1638 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -8011,8 +8011,8 @@ 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; + $id = !empty($info['entity keys']) ? ( isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL ) : NULL; + $vid = !empty($info['entity keys']) ? (($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL ) : NULL; if (!empty($info['entity keys']['bundle'])) { // Explicitly fail for malformed entities missing the bundle property.