diff --git a/core/modules/node/src/Form/DeleteMultiple.php b/core/modules/node/src/Form/DeleteMultiple.php index a5686dc..68923ac 100644 --- a/core/modules/node/src/Form/DeleteMultiple.php +++ b/core/modules/node/src/Form/DeleteMultiple.php @@ -97,8 +97,11 @@ public function getConfirmText() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { - $this->nodes = $this->tempStoreFactory->get('node_multiple_delete_confirm')->get(\Drupal::currentUser()->id()); + $current_user_id = $this->currentUser()->id(); + $node_temp_store = $this->tempStoreFactory->get('node_multiple_delete_confirm'); + $this->nodes = $node_temp_store->get($current_user_id); if (empty($this->nodes)) { + $node_temp_store->delete($current_user_id); throw new AccessDeniedHttpException(); } diff --git a/core/modules/simpletest/src/Form/SimpletestResultsForm.php b/core/modules/simpletest/src/Form/SimpletestResultsForm.php index 7d39496..e2798b1 100644 --- a/core/modules/simpletest/src/Form/SimpletestResultsForm.php +++ b/core/modules/simpletest/src/Form/SimpletestResultsForm.php @@ -15,7 +15,6 @@ use Drupal\Core\Url; use Drupal\simpletest\TestDiscovery; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; /** * Test results form for $test_id. @@ -114,7 +113,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $test_id if (is_numeric($test_id) && !$results = $this->getResults($test_id)) { drupal_set_message($this->t('No test results to display.'), 'error'); - return new RedirectResponse($this->url('simpletest.test_form', array(), array('absolute' => TRUE))); + return $this->redirect('simpletest.test_form'); } // Load all classes and include CSS. diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php index d2949a6..278e2f1 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php @@ -129,6 +129,10 @@ function testWebTestRunner() { // Regression test for #290316. // Check that test_id is incrementing. $this->assertTrue($this->test_ids[0] != $this->test_ids[1], 'Test ID is incrementing.'); + + // Attempt to retrieve results for a non-existent test run ID. + $this->drupalGet('admin/config/development/testing/results/' . ($this->test_ids[1] + 1)); + $this->assertRaw('No test results to display'); } } diff --git a/core/modules/system/src/Form/CronForm.php b/core/modules/system/src/Form/CronForm.php index cfb82fd..5956c34 100644 --- a/core/modules/system/src/Form/CronForm.php +++ b/core/modules/system/src/Form/CronForm.php @@ -14,7 +14,6 @@ use Drupal\Core\State\StateInterface; use Drupal\Core\Form\ConfigFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; /** * Configure cron settings for this site. @@ -144,7 +143,7 @@ public function submitCron(array &$form, FormStateInterface $form_state) { drupal_set_message(t('Cron run failed.'), 'error'); } - return new RedirectResponse($this->url('system.cron_settings', array(), array('absolute' => TRUE))); + return $this->redirect('system.cron_settings'); } } diff --git a/core/modules/user/src/Form/UserMultipleCancelConfirm.php b/core/modules/user/src/Form/UserMultipleCancelConfirm.php index 45f340f..17ec9fb 100644 --- a/core/modules/user/src/Form/UserMultipleCancelConfirm.php +++ b/core/modules/user/src/Form/UserMultipleCancelConfirm.php @@ -15,6 +15,7 @@ use Drupal\user\TempStoreFactory; use Drupal\user\UserStorageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** * Provides a confirmation form for cancelling multiple user accounts. @@ -101,12 +102,13 @@ public function getConfirmText() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + $current_user_id = $this->currentUser()->id(); + $user_temp_store = $this->tempStoreFactory->get('user_user_operations_cancel'); // Retrieve the accounts to be canceled from the temp store. - $accounts = $this->tempStoreFactory - ->get('user_user_operations_cancel') - ->get($this->currentUser()->id()); + $accounts = $user_temp_store->get($current_user_id); if (!$accounts) { - return $this->redirect('user.admin_account'); + $user_temp_store->delete($current_user_id); + throw new AccessDeniedHttpException(); } $form['accounts'] = array('#prefix' => '