Hi guys check out this patch that fixes a variable name on entity_access. It seems that $entity_id got renamed, moved, and removed on one the last commits.

 $entity_ids = entity_get_id_by_uuid($entity_type, array($args[1]));
    $entity = NULL;
    if (!empty($args[2])) {
      $entity = entity_create($entity_type, $args[2]);
      // We have to make the entity local (i.e. only have local references), for
      // access functions to work on it.
      entity_make_entity_local($entity_type, $entity);
    }
    // Fetch the local entity if we've got an id.
    elseif (!empty($entity_id)) {
      $entities = entity_load($entity_type, $entity_ids);
      $entity = reset($entities);
    }

As you can see $entity_id is always empty and the variable should be $entity_ids.

Cheers.

Comments

lucascaro’s picture

Assigned: Unassigned » lucascaro
socialnicheguru’s picture

checked the uuid code and you're right it was changed to entity_ids

socialnicheguru’s picture

there are a few places where the change was not made:
cd modules/uuid
grep -in entity_id -d recurse *

however it is referenced here:
plugins/arguments/entity_uuid.inc:65: $entity_id = $entity_ids[$arg];
plugins/arguments/entity_uuid.inc:66: $entities = entity_load($entity_type, array($entity_id));
plugins/arguments/entity_uuid.inc:71: return ctools_context_create('entity:' . $entity_type, $entities[$entity_id]);

lucascaro’s picture

@SocialNicheGuru I think those other cases you pointed out are actually meant to be a different variable, $entity_id. AFAIK the only problem was that one variable name in that line that needs to be updated.

In general though, if it's an array, it should be $entity_ids and if it's a scalar (just one id) it should be $entity_id.

Anyways, without the patch $entity never gets loaded by the code.

cheers.

dillix’s picture

When this bug will be fixed?

dillix’s picture

Status: Needs review » Reviewed & tested by the community
jpstrikesback’s picture

EDIT: I'm changing the status to critical here, this little gem borks uuid_services retrieve nicely, albeit not in all circumstances, but likely most.

When tested with any user that has the administer users permission we are immediately granted access, any other user without that specific permission will be denied access as the entity object to check is NULL due to the issue described and fixed here.

kevinquillen’s picture

Priority: Major » Critical

Sounds like the critical bugs need to be round up into an achievable list so a release can be made. There are different facets of UUID that, depending on what you are doing, can cause fatal errors. See #1663390: Roll a new UUID stable release - it's been an extremely long time since a release and there are some pretty heavy bugs sitting in the last stable release.

jpstrikesback’s picture

Assigned: lucascaro » Unassigned

Reassigning to unassigned.

dixon_’s picture

Status: Reviewed & tested by the community » Fixed

Patch from OP is committed to 7.x-1.x-dev. Thanks!

Status: Fixed » Closed (fixed)

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