diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index 5a82413..5307fd9 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -35,7 +35,9 @@ public function viewAccess(EntityInterface $node, $langcode = LANGUAGE_DEFAULT, // Check if authors can view their own unpublished nodes. $status = $node->get('status', $langcode); - $account = $account ?: $GLOBALS['user']; + if (!$account) { + $account = entity_create('user', (array) $GLOBALS['user']); + } if (!$status && user_access('view own unpublished content', $account) && $account->uid == $node->get('uid', $langcode) && $account->uid != 0) { $this->setCached(TRUE, $node, 'view', $langcode, $account); return TRUE;