diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php index ee5208b078..e5296edafa 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php @@ -128,7 +128,7 @@ public function processAttachments(AttachmentsInterface $response) { * An array of commands ready to be returned as JSON. */ protected function buildAttachmentsCommands(AjaxResponse $response, Request $request) { - $ajax_page_state = $request->request->get('ajax_page_state'); + $ajax_page_state = $request->request->all()['ajax_page_state'] ?? []; // Aggregate CSS/JS if necessary, but only during normal site operation. $optimize_css = !defined('MAINTENANCE_MODE') && $this->config->get('css.preprocess'); diff --git a/core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php b/core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php index c445d8507c..b2fd174be3 100644 --- a/core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php @@ -61,7 +61,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch $title = isset($main_content['#title']) ? $main_content['#title'] : $this->titleResolver->getTitle($request, $route_match->getRouteObject()); // Determine the dialog options and the target for the OpenDialogCommand. - $options = $request->request->get('dialogOptions', []); + $options = $request->request->all()['dialogOptions'] ?? []; $target = $this->determineTargetSelector($options, $route_match); $response->addCommand(new OpenDialogCommand($target, $title, $content, $options)); diff --git a/core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php b/core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php index d250d57329..56c6050a6f 100644 --- a/core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php @@ -31,7 +31,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch // Determine the title: use the title provided by the main content if any, // otherwise get it from the routing information. - $options = $request->request->get('dialogOptions', []); + $options = $request->request->all()['dialogOptions'] ?? []; $response->addCommand(new OpenModalDialogCommand($title, $content, $options)); return $response; diff --git a/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php index 086e84f929..b251112373 100644 --- a/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php @@ -64,7 +64,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch // Determine the title: use the title provided by the main content if any, // otherwise get it from the routing information. - $options = $request->request->get('dialogOptions', []); + $options = $request->request->all()['dialogOptions'] ?? []; $response->addCommand(new OpenOffCanvasDialogCommand($title, $content, $options, NULL, $this->position)); return $response; } diff --git a/core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php b/core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php index 5cd2ee3057..45da790c35 100644 --- a/core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php +++ b/core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php @@ -65,7 +65,7 @@ public function __construct(CsrfTokenGenerator $token_generator, ConfigFactoryIn * {@inheritdoc} */ public function applies(RouteMatchInterface $route_match) { - $ajax_page_state = $this->requestStack->getCurrentRequest()->request->get('ajax_page_state'); + $ajax_page_state = $this->requestStack->getCurrentRequest()->request->all()['ajax_page_state'] ?? []; return !empty($ajax_page_state['theme']) && isset($ajax_page_state['theme_token']); } @@ -73,7 +73,7 @@ public function applies(RouteMatchInterface $route_match) { * {@inheritdoc} */ public function determineActiveTheme(RouteMatchInterface $route_match) { - $ajax_page_state = $this->requestStack->getCurrentRequest()->request->get('ajax_page_state'); + $ajax_page_state = $this->requestStack->getCurrentRequest()->request->all()['ajax_page_state'] ?? []; $theme = $ajax_page_state['theme']; $token = $ajax_page_state['theme_token']; diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php index b44cf13245..6b620e6761 100644 --- a/core/modules/comment/src/Controller/CommentController.php +++ b/core/modules/comment/src/Controller/CommentController.php @@ -337,7 +337,7 @@ public function renderNewCommentsNodeLinks(Request $request) { throw new AccessDeniedHttpException(); } - $nids = $request->request->get('node_ids'); + $nids = $request->request->all()['node_ids'] ?? []; $field_name = $request->request->get('field_name'); if (!isset($nids)) { throw new NotFoundHttpException(); diff --git a/core/modules/contextual/src/ContextualController.php b/core/modules/contextual/src/ContextualController.php index cd6ddb40a8..126e84f1a8 100644 --- a/core/modules/contextual/src/ContextualController.php +++ b/core/modules/contextual/src/ContextualController.php @@ -60,12 +60,12 @@ public static function create(ContainerInterface $container) { * @see contextual_preprocess() */ public function render(Request $request) { - $ids = $request->request->get('ids'); + $ids = $request->request->all()['ids'] ?? []; if (!isset($ids)) { throw new BadRequestHttpException('No contextual ids specified.'); } - $tokens = $request->request->get('tokens'); + $tokens = $request->request->all()['tokens'] ?? []; if (!isset($tokens)) { throw new BadRequestHttpException('No contextual ID tokens specified.'); } diff --git a/core/modules/field_ui/src/Form/FieldConfigEditForm.php b/core/modules/field_ui/src/Form/FieldConfigEditForm.php index db8122c4d9..0539271331 100644 --- a/core/modules/field_ui/src/Form/FieldConfigEditForm.php +++ b/core/modules/field_ui/src/Form/FieldConfigEditForm.php @@ -206,7 +206,7 @@ public function save(array $form, FormStateInterface $form_state) { $this->messenger()->addStatus($this->t('Saved %label configuration.', ['%label' => $this->entity->getLabel()])); $request = $this->getRequest(); - if (($destinations = $request->query->get('destinations')) && $next_destination = FieldUI::getNextDestination($destinations)) { + if (($destinations = ($request->query->all()['destinations'] ?? [])) && $next_destination = FieldUI::getNextDestination($destinations)) { $request->query->remove('destinations'); $form_state->setRedirectUrl($next_destination); } diff --git a/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php b/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php index 6ec88c9788..aede31447c 100644 --- a/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php @@ -224,7 +224,7 @@ public function save(array $form, FormStateInterface $form_state) { $this->entity->save(); $this->messenger()->addStatus($this->t('Updated field %label field settings.', ['%label' => $field_label])); $request = $this->getRequest(); - if (($destinations = $request->query->get('destinations')) && $next_destination = FieldUI::getNextDestination($destinations)) { + if (($destinations = ($request->query->all()['destinations'] ?? [])) && $next_destination = FieldUI::getNextDestination($destinations)) { $request->query->remove('destinations'); $form_state->setRedirectUrl($next_destination); } diff --git a/core/modules/history/src/Controller/HistoryController.php b/core/modules/history/src/Controller/HistoryController.php index c6a4834903..ed192994ef 100644 --- a/core/modules/history/src/Controller/HistoryController.php +++ b/core/modules/history/src/Controller/HistoryController.php @@ -28,7 +28,7 @@ public function getNodeReadTimestamps(Request $request) { throw new AccessDeniedHttpException(); } - $nids = $request->request->get('node_ids'); + $nids = $request->request->all()['node_ids'] ?? []; if (!isset($nids)) { throw new NotFoundHttpException(); } diff --git a/core/modules/jsonapi/src/Controller/EntityResource.php b/core/modules/jsonapi/src/Controller/EntityResource.php index 4bd865bc0a..e061cfcf97 100644 --- a/core/modules/jsonapi/src/Controller/EntityResource.php +++ b/core/modules/jsonapi/src/Controller/EntityResource.php @@ -1208,13 +1208,13 @@ protected function entityExists(EntityInterface $entity) { */ protected function getJsonApiParams(Request $request, ResourceType $resource_type) { if ($request->query->has('filter')) { - $params[Filter::KEY_NAME] = Filter::createFromQueryParameter($request->query->get('filter'), $resource_type, $this->fieldResolver); + $params[Filter::KEY_NAME] = Filter::createFromQueryParameter($request->query->all()['filter'] ?? [], $resource_type, $this->fieldResolver); } if ($request->query->has('sort')) { - $params[Sort::KEY_NAME] = Sort::createFromQueryParameter($request->query->get('sort')); + $params[Sort::KEY_NAME] = Sort::createFromQueryParameter($request->query->all()['sort'] ?? []); } if ($request->query->has('page')) { - $params[OffsetPage::KEY_NAME] = OffsetPage::createFromQueryParameter($request->query->get('page')); + $params[OffsetPage::KEY_NAME] = OffsetPage::createFromQueryParameter($request->query->all()['page'] ?? []); } else { $params[OffsetPage::KEY_NAME] = OffsetPage::createFromQueryParameter(['page' => ['offset' => OffsetPage::DEFAULT_OFFSET, 'limit' => OffsetPage::SIZE_MAX]]); diff --git a/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php b/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php index 414ae766b1..31c59199cd 100644 --- a/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php +++ b/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php @@ -144,10 +144,10 @@ protected static function generateContext(Request $request) { 'account' => NULL, 'sparse_fieldset' => NULL, ]; - if ($request->query->get('fields')) { + if ($fields = ($request->query->all()['fields'] ?? [])) { $context['sparse_fieldset'] = array_map(function ($item) { return explode(',', $item); - }, $request->query->get('fields')); + }, $fields); } return $context; } diff --git a/core/modules/media_library/src/MediaLibraryState.php b/core/modules/media_library/src/MediaLibraryState.php index e1fd6e2e8b..d4f0da9d6c 100644 --- a/core/modules/media_library/src/MediaLibraryState.php +++ b/core/modules/media_library/src/MediaLibraryState.php @@ -99,10 +99,10 @@ public static function fromRequest(Request $request) { // all validation runs. $state = static::create( $query->get('media_library_opener_id'), - $query->get('media_library_allowed_types', []), + $query->all()['media_library_allowed_types'] ?? [], $query->get('media_library_selected_type'), $query->get('media_library_remaining'), - $query->get('media_library_opener_parameters', []) + $query->all()['media_library_opener_parameters'] ?? [] ); // The request parameters need to contain a valid hash to prevent a @@ -222,7 +222,7 @@ public function getOpenerId() { * The media type IDs. */ public function getAllowedTypeIds() { - return $this->get('media_library_allowed_types'); + return $this->all()['media_library_allowed_types'] ?? []; } /** @@ -266,7 +266,7 @@ public function getAvailableSlots() { * An associative array of all opener-specific parameter values. */ public function getOpenerParameters() { - return $this->get('media_library_opener_parameters', []); + return $this->all()['media_library_opener_parameters'] ?? []; } } diff --git a/core/modules/menu_ui/src/Controller/MenuController.php b/core/modules/menu_ui/src/Controller/MenuController.php index 7958c101ac..53374b61b3 100644 --- a/core/modules/menu_ui/src/Controller/MenuController.php +++ b/core/modules/menu_ui/src/Controller/MenuController.php @@ -50,7 +50,7 @@ public static function create(ContainerInterface $container) { */ public function getParentOptions(Request $request) { $available_menus = []; - if ($menus = $request->request->get('menus')) { + if ($menus = ($request->request->all()['menus'] ?? [])) { foreach ($menus as $menu) { $available_menus[$menu] = $menu; } diff --git a/core/modules/quickedit/src/QuickEditController.php b/core/modules/quickedit/src/QuickEditController.php index bc81769cdb..f9ada245ab 100644 --- a/core/modules/quickedit/src/QuickEditController.php +++ b/core/modules/quickedit/src/QuickEditController.php @@ -116,11 +116,11 @@ public static function create(ContainerInterface $container) { * The JSON response. */ public function metadata(Request $request) { - $fields = $request->request->get('fields'); + $fields = $request->request->all()['fields'] ?? []; if (!isset($fields)) { throw new NotFoundHttpException(); } - $entities = $request->request->get('entities'); + $entities = $request->request->all()['entities'] ?? []; $metadata = []; foreach ($fields as $field) { @@ -168,7 +168,7 @@ public function metadata(Request $request) { */ public function attachments(Request $request) { $response = new AjaxResponse(); - $editors = $request->request->get('editors'); + $editors = $request->request->all()['editors'] ?? []; if (!isset($editors)) { throw new NotFoundHttpException(); } @@ -229,7 +229,7 @@ public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view // Re-render the updated field for other view modes (i.e. for other // instances of the same logical field on the user's page). - $other_view_mode_ids = $request->request->get('other_view_modes') ?: []; + $other_view_mode_ids = $request->request->all()['other_view_modes'] ?? []; $other_view_modes = array_map($render_field_in_view_mode, array_combine($other_view_mode_ids, $other_view_mode_ids)); $response->addCommand(new FieldFormSavedCommand($output, $other_view_modes)); diff --git a/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php b/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php index aecb4dd0de..55ec25c7ee 100644 --- a/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php +++ b/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php @@ -60,7 +60,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch // Determine the title: use the title provided by the main content if any, // otherwise get it from the routing information. - $options = $request->request->get('dialogOptions', []); + $options = $request->request->all()['dialogOptions'] ?? []; // Override width option. switch ($this->mode) { case 'wide': diff --git a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php index 1b45615fd8..b864b603ea 100644 --- a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php +++ b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php @@ -66,7 +66,7 @@ public function getArgument() { $current_request = $this->view->getRequest(); if ($current_request->query->has($this->options['query_param'])) { - $param = $current_request->query->get($this->options['query_param']); + $param = $current_request->query->all()[$this->options['query_param']]; if (is_array($param)) { $conjunction = ($this->options['multiple'] == 'and') ? ',' : '+'; $param = implode($conjunction, $param);