API page: http://api.drupal.org/api/drupal/modules%21node%21node.module/function/_...

A comment for the code contains a typo: It says $acount instead of $account.

  // If $account can bypass node access, or there are no node access modules,
  // or the operation is 'view' and the $acount has a global view grant (i.e.,
  // a view grant for node ID 0), we don't need to alter the query.

At the same time, I would replace i.e. with for example, as that is just an example of global view grant, or with such as.

I am reporting this for Drupal 7, as Drupal 8 doesn't define this function.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

apaderno’s picture

FileSize
694 bytes

This is the patch.

apaderno’s picture

Version: 7.x-dev » 8.x-dev
Status: Active » Needs review
FileSize
725 bytes

I found the Drupal 8 function: It's node_query_node_access_alter(). The patch I attach here is for Drupal 8.

apaderno’s picture

The first patch fails because I changed the Drupal version associated with this issue; in fact PIFR is getting the code for Drupal 8, as it is evident from the log. ([drupal.core.version] => 8).

Status: Needs review » Needs work

The last submitted patch, fix-typo-1856142-2.patch, failed testing.

apaderno’s picture

Status: Needs work » Needs review
FileSize
725 bytes

Let's try again. I noticed there has been a commit right after I updated my local repository, and created the patch. I checked the patched file didn't cause any syntax error with php -l, and I didn't get any error.

jhodgdon’s picture

Status: Needs review » Fixed

Thanks! Committed to 8.x and 7.x.

tstoeckler’s picture

Status: Fixed » Reviewed & tested by the community

AFAIC, this was only committed/pushed to a 9.x branch. Searching for this issue number on drupalcode.org yields only this. I don't know the reason for that, but I don't think it was intented this way.

Dries’s picture

I believe this is applied to 8.x. When I try to apply it to the head of 8.x I get:

vortex:drupal dries$ git apply -v ../f.patch --index
Checking patch core/modules/node/node.module...
error: while searching for:
  }

  // If $account can bypass node access, or there are no node access modules,
  // or the operation is 'view' and the $acount has a global view grant (i.e.,
  // a view grant for node ID 0), we don't need to alter the query.
  if (user_access('bypass node access', $account)) {
    return;
  }

error: patch failed: core/modules/node/node.module:3028
error: core/modules/node/node.module: patch does not apply
Dries’s picture

Sorry, I take that back. The snippet in my comment above appears to be the old documentation. That said, this patch no longer seems to apply. Asking for a re-test.

Dries’s picture

#5: fix-typo-1856142-5.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, fix-typo-1856142-5.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Fixed

Well, I looked back into my command-line history and here is what I did when I committed that patch:

  26  git checkout 8.x
   27  patch -p1 < ~/Desktop/fix-typo-1856142-5.patch 
   28  git diff
   29  git add -u
   30  git commit -m "Issue #1856142 by kiamlaluno: Fix typo in node_query_node_
access_alter() comment"
   31  git push
   32  git checkout 7.x
   33  patch -p2 < ~/Desktop/fix-typo-1856142-5.patch 
   34  cleanrepo
   35  git diff
   36  git commit -m "Issue #1856142 by kiamlaluno: Fix typo in node_query_node_
access_alter() comment"
   37  git add -u
   38  git commit -m "Issue #1856142 by kiamlaluno: Fix typo in node_query_node_
access_alter() comment"
   39  git push

As a note, "cleanrepo" is an alias for

alias cleanrepo='find . -regextype posix-extended -regex ".*(rej|orig)" -delete'

And I don't have anywhere in my git history where it says "git checkout 9.x". So I don't see how I could have committed it to the 9.x. The patch is there in 8.x.

Oh.... It looks like what you are seeing is that Dries created the 9.x branch just after I committed that patch. So that commit is the one that is tagged/branched as the start of 9.x. The patch was not committed to 9.x. We are fine. Take a look at:
http://drupalcode.org/project/drupal.git/shortlog/refs/heads/9.x
which basically has the entire history of 8.x up through that one commit, and then the 9.x branch is created at that last commit.

tstoeckler’s picture

OK. I didn't know that the tagging of 9.x was intentional and what really put me off, that you can't find the commit on drupalcode.org for the 8.x branch. But apparently it was applied, so whatever. Sorry for the noise. And thanks for clearing that up.

Status: Fixed » Closed (fixed)

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