I'm getting the next error fourth times on every page with the current stable version:

Notice: Undefined variable: grants in Drupal\permissions_by_term\AccessStorage->getGidsByRealm() (line 480 of modules/permissions_by_term/src/AccessStorage.php).

My enviroment is:

  • Drupal: 8.2.5
  • Permissions by Term: 8.x-1.12
  • Devel: 8.x-1.0-beta1

When i updated Drupal with Drush, it says this:

No database updates required

The full error is:

Drupal\permissions_by_term\AccessStorage->getGidsByRealm('permissions_by_term__uid_0') (Line: 208)
permissions_by_term_node_grants(Object, 'view')
call_user_func_array('permissions_by_term_node_grants', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('node_grants', Array) (Line: 954)
node_access_grants('view', Object) (Line: 139)
Drupal\node\NodeGrantDatabaseStorage->checkAll(Object) (Line: 192)
Drupal\node\NodeAccessControlHandler->checkAllGrants(Object) (Line: 1000)
node_access_view_all_nodes(Object) (Line: 69)
Drupal\node\Cache\NodeAccessGrantsCacheContext->checkNodeGrants('view') (Line: 50)
Drupal\node\Cache\NodeAccessGrantsCacheContext->getContext('view') (Line: 118)
Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys(Array) (Line: 307)
Drupal\Core\Render\RenderCache->createCacheID(Array) (Line: 66)
Drupal\Core\Render\RenderCache->get(Array) (Line: 109)
Drupal\Core\Render\PlaceholderingRenderCache->get(Array) (Line: 77)
Drupal\Core\Render\RenderCache->get(Array) (Line: 109)
Drupal\Core\Render\PlaceholderingRenderCache->get(Array) (Line: 263)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 207)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 121)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 75)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

merolhack created an issue. See original summary.

merolhack’s picture

*Note: Is a multilingual site.

In the node_access table i have 18 rows like this, with the realm "all"

nid langcode fallback gid realm grant_view grant_update grant_delete
1 en 0 0 all 1 0 0
1 es 1 0 all 1 0 0
2 en 0 0 all 1 0 0
2 es 1 0 all 1 0 0

  • jepSter committed 943616f on 8.x-1.x
    Issue #2841686 by merolhack, jepSter: Fixed "Notice: Undefined variable...
jepster_’s picture

Status: Active » Fixed

That's because you need to run node_access_rebuild() for the initial creation of the grants in node_access table. You can do this manually by calling /admin/reports/status/rebuild or you can update to 8.x-1.13. The node_access_rebuild() Drupal core function is called on installation and the update to 8.x-1.13.

Thanks for reporting. Please re-open this issue, if you have any further objections.

Status: Fixed » Closed (fixed)

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