diff --cc core/modules/user/src/Plugin/views/filter/Roles.php index 47adafb8b6,83b68c4c20..0000000000 --- a/core/modules/user/src/Plugin/views/filter/Roles.php +++ b/core/modules/user/src/Plugin/views/filter/Roles.php @@@ -74,10 -74,15 +74,19 @@@ class Roles extends ManyToOne */ public function calculateDependencies() { $dependencies = []; + + if (in_array($this->operator, ['empty', 'not empty'])) { + return $dependencies; + } - foreach ($this->value as $role_id) { ++ + // Due to a bug $this->value might be a string, see + // https://www.drupal.org/node/2846614. In the empty case stop early. + // Otherwise we cast it to an array later. + if (is_string($this->value) && $this->value === '') { + return []; + } + + foreach ((array) $this->value as $role_id) { $role = $this->roleStorage->load($role_id); $dependencies[$role->getConfigDependencyKey()][] = $role->getConfigDependencyName(); }