If the current user has no permission 'administer line items' AND commerce_order modul not exist in commerce_line_item_access() function has no return value!

ps: use Phpstorm, this write to me well :)

Current code:

function commerce_line_item_access($op, $line_item, $account = NULL) {
  global $user;
  $account = isset($account) ? $account : clone($user);

  // If the user has the administration permission, return TRUE now.
  if (user_access('administer line items', $account)) {
    return TRUE;
  }

  // For users who don't have the general administration permission, we have to
  // determine access to update or delete a given line item through a connection
  // to an Order.
  if (!empty($line_item->order_id) && module_exists('commerce_order')) {
    $order = commerce_order_load($line_item->order_id);
    return commerce_order_access($op, $order, $account);
  }
}

Comments

rszrama’s picture

I suppose this should just be returning FALSE?

rszrama’s picture

Title: Missing default return value » Missing default return value in commerce_line_item_access()
Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Fixed

Went ahead and updated this to return FALSE if we pass through that order if statement.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/f3dfdac

Status: Fixed » Closed (fixed)

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