diff -u b/core/modules/node/node.api.php b/core/modules/node/node.api.php --- b/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -27,7 +27,8 @@ * module; it is common to use role IDs as grant IDs, but that is not required. * Your module could instead maintain its own list of users, where each list has * an ID. In that case, the return value of this hook would be an array of the - * list IDs that this user is a member of. Do not use 'all' as a realm. + * list IDs that this user is a member of. 'all' is a reserved realm and can't + * be used. * * A node access module may implement as many realms as necessary to properly * define the access privileges for the nodes. Note that the system makes no diff -u b/core/modules/node/src/NodeGrantDatabaseStorage.php b/core/modules/node/src/NodeGrantDatabaseStorage.php --- b/core/modules/node/src/NodeGrantDatabaseStorage.php +++ b/core/modules/node/src/NodeGrantDatabaseStorage.php @@ -108,6 +108,7 @@ */ public function checkAll(AccountInterface $account) { $query = $this->database->select('node_access'); + // The method should return 0 or 1 so start with SELECT 1. $query->addExpression('1'); $query ->condition('nid', 0) @@ -118,7 +119,9 @@ if (count($grants) > 0 ) { $query->condition($grants); } - return (int) $query->execute()->fetchField(); + // The query either returns 1 from SELECT 1 or FALSE, cast to int to make + // sure the return value is 0 or 1 as prescribed on the interface. + return (int) $query->range(0, 1)->execute()->fetchField(); } /**