Part of #1998638: Replace almost all remaining superglobals ($_GET, $_POST, etc.) with Symfony Request object

Files that need converting are:

  • core/modules/node/lib/Drupal/node/NodeFormController.php
Files: 
CommentFileSizeAuthor
#9 remove_request_in_node-1999404-5.patch840 bytesjiff
PASSED: [[SimpleTest]]: [MySQL] 56,793 pass(es).
[ View ]
#4 remove_request_in_node-1999404-4.patch836 bytesmongolito404
PASSED: [[SimpleTest]]: [MySQL] 55,912 pass(es).
[ View ]
#1 remove-request.patch836 bytesmarcingy
PASSED: [[SimpleTest]]: [MySQL] 55,831 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new836 bytes
PASSED: [[SimpleTest]]: [MySQL] 55,831 pass(es).
[ View ]

Status:Needs review» Needs work

The last submitted patch, remove-request.patch, failed testing.

Status:Needs work» Needs review

#1: remove-request.patch queued for re-testing.

StatusFileSize
new836 bytes
PASSED: [[SimpleTest]]: [MySQL] 55,912 pass(es).
[ View ]

+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -464,9 +464,9 @@ public function save(array $form, array &$form_state) {
-    if (isset($_GET['destination'])) {

Should be \Drupal::request()->query->has('destination').

Status:Needs review» Needs work

The last submitted patch, remove_request_in_node-1999404-4.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

+++ b/core/modules/node/lib/Drupal/node/NodeFormController.phpundefined
@@ -464,9 +464,9 @@ public function save(array $form, array &$form_state) {
-    if (isset($_GET['destination'])) {
+    if (\Drupal::request()->query->has('destination')) {
       $destination = drupal_get_destination();
-      unset($_GET['destination']);
+      \Drupal::request()->query->remove('destination');

Let's use a variable to make this less verbose.

Status:Needs work» Needs review
StatusFileSize
new840 bytes
PASSED: [[SimpleTest]]: [MySQL] 56,793 pass(es).
[ View ]

Status:Needs review» Reviewed & tested by the community

This is replacing one evil horrid hack for a new-code evil horrid hack. So, I guess we accept it for now. :-)

Issue tags:+Quick fix

Tagging

Status:Reviewed & tested by the community» Fixed

Committed 2d5b6c4 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.