diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php index 7b07f84..66fb0d6 100644 --- a/core/modules/user/lib/Drupal/user/AccountFormController.php +++ b/core/modules/user/lib/Drupal/user/AccountFormController.php @@ -229,13 +229,16 @@ public function form(array $form, array &$form_state) { * {@inheritdoc} */ public function buildEntity(array $form, array &$form_state) { - $changed_form_state = $form_state; // Change the roles array to a list of enabled roles. // @todo: Alter the form state as the form values are directly extracted and // set on the field, which throws an exception as the list requires - // numeric keys. Allow to override this per field. - $changed_form_state['values']['roles'] = array_keys(array_filter($changed_form_state['values']['roles'])); - return parent::buildEntity($form, $changed_form_state); + // numeric keys. Allow to override this per field. As this function is + // called twice, we have to prevent it from getting the array keys twice. + if (empty($this->roles_filtered)) { + $form_state['values']['roles'] = array_keys(array_filter($form_state['values']['roles'])); + $this->roles_filtered = TRUE; + } + return parent::buildEntity($form, $form_state); } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php index 597ce11..d5c4375 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php @@ -47,7 +47,7 @@ protected function setUp() { $this->normal_user = $this->drupalCreateUser(array('views_test_data test permission')); // @todo: How to add a new item to the roles field list. - $this->normal_user->getNGEntity()->roles[]->value = $this->normal_role; + $this->normal_user->getNGEntity()->roles[2]->value = $this->normal_role; // @todo when all the plugin information is cached make a reset function and // call it here. }