Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
$wrapper->entity_reference_single->access('view') will return FALSE for the entity_test since there's no access callback defined, so entity_access() return NULL.
Patch will follow.
Comment | File | Size | Author |
---|---|---|---|
#2 | interdiff.txt | 662 bytes | amitaibu |
#2 | 2264079-entity-wrapper-access-single-entity-reference-2.patch | 1.23 KB | amitaibu |
#1 | 2264079-entity-wrapper-access-single-entity-reference-1.patch | 766 bytes | amitaibu |
Comments
Comment #1
amitaibuPatch explicitly checks for FALSE.
Comment #2
amitaibuFound another place where we ignore the NULL value.
Comment #3
joshk CreditAttribution: joshk commentedAny idea what needs to happen for this to get rolled in?
Comment #4
e0ipsoThis works as expected.
Comment #6
fagoIndeed, it should return TRUE if we do not know access. I fixed those return statements to return FALSE instead of NULL though, as it's documented that we return a boolean and this does not change existing behaviour then.
Committed, thanks.
Comment #8
bdupls CreditAttribution: bdupls commentedI am running entity 7.1.6 and get this error
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 737 of /Users/xxx/Sites/xxx/sites/all/modules/entity/includes/entity.wrapper.inc).
There seems to be other posts of this error so it seems that it is still a problem.
https://www.drupal.org/node/1519884
https://www.drupal.org/node/1925412
Is this caused by another module using entity? How do I problem solve?