diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index 61439b1..c2a48d2 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -187,7 +187,12 @@ public function isPublished() { * {@inheritdoc} */ public function getAuthor() { - return $this->get('uid')->entity->getBCEntity(); + $entity = $this->get('uid')->entity; + // If no user is given, default to the anonymous user. + if (!$entity) { + return user_load(0)->getBCentity(); + } + return $entity->getBCEntity(); } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 30497c4..903e876 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2822,13 +2822,13 @@ function node_query_node_access_alter(AlterableInterface $query) { * via hook_node_access_records_alter() implementations, and saves the collected * and altered grants to the database. * - * @param \Drupal\Core\Entity\EntityInterface $node + * @param \Drupal\node\NodeInterface $node * The $node to acquire grants for. * @param $delete * (optional) Whether to delete existing node access records before inserting * new ones. Defaults to TRUE. */ -function node_access_acquire_grants(\Drupal\node\NodeInterface $node, $delete = TRUE) { +function node_access_acquire_grants(NodeInterface $node, $delete = TRUE) { $grants = module_invoke_all('node_access_records', $node); // Let modules alter the grants. drupal_alter('node_access_records', $grants, $node);