diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-05-21 15:52:19 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-05-21 15:52:19 +0000 |
commit | f10d7281250b0027e459a7ac96829573285e8672 (patch) | |
tree | 7702dc15648f460456ea47567a53aecb11d7c1f5 | |
parent | 9537ac63aacbeb05b45f2bac908bd1f04e79de2f (diff) | |
download | brdo-f10d7281250b0027e459a7ac96829573285e8672.tar.gz brdo-f10d7281250b0027e459a7ac96829573285e8672.tar.bz2 |
- Patch #803650 by aaronbauman: calling entity_create_stub_entity() with a revision id creates fatal error unversioned entity types.
-rw-r--r-- | includes/common.inc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc index a1169d174..e2fa6dea3 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6452,7 +6452,7 @@ function entity_extract_ids($entity_type, $entity) { * containing these elements: * 0: primary id of the entity * 1: revision id of the entity, or NULL if $entity_type is not versioned - * 2: bundle name of the entity + * 2: bundle name of the entity, or NULL if $entity_type has no bundles * @return * An entity structure, initialized with the ids provided. */ @@ -6460,10 +6460,10 @@ function entity_create_stub_entity($entity_type, $ids) { $entity = new stdClass(); $info = entity_get_info($entity_type); $entity->{$info['entity keys']['id']} = $ids[0]; - if (isset($info['entity keys']['revision']) && !is_null($ids[1])) { + if (!empty($info['entity keys']['revision']) && !is_null($ids[1])) { $entity->{$info['entity keys']['revision']} = $ids[1]; } - if ($info['entity keys']['bundle']) { + if (!empty($info['entity keys']['bundle']) && !is_null($ids[2])) { $entity->{$info['entity keys']['bundle']} = $ids[2]; } return $entity; |