#1984610: Convert user_pass to a new-style Form object showed us that you can't inject the request object into the form method.

Instead of manually using some reflection we can rely on the controller resolver which does all this fancy logic.

Files: 
CommentFileSizeAuthor
#11 drupal-1998166-11.patch6.63 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 55,736 pass(es).
[ View ]
#6 drupal-1998166-6.patch6.51 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] 55,898 pass(es), 583 fail(s), and 1,658 exception(s).
[ View ]
#6 interdiff.txt806 bytesdawehner
#1 drupal-1998166-1.patch6.63 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 56,291 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new6.63 KB
PASSED: [[SimpleTest]]: [MySQL] 56,291 pass(es).
[ View ]

Issue tags:+WSCCI

tagging

+++ b/core/lib/Drupal/Core/Controller/HtmlFormController.php
@@ -50,15 +50,16 @@ public function content(Request $request, $_form) {
+    // At the form and form_state to trick the getArguments method of the
+    // controller resolver.
+    $form_state = array();
+    $request->attributes->set('form', array());
+    $request->attributes->set('form_state', $form_state);
+    $args = $this->container->get('controller_resolver')->getArguments($request, array($form_object, 'buildForm'));
+    unset($args[0], $args[1]);
+    $request->attributes->remove('form');

I'm not sure I'd even bother removing form and form_state at the end. It doesn't hurt anything, does it?.

Otherwise, I like this cleanup.

I hope noone has the idea to put 'form' into the request attributes manually.

Mm, true, that would cause a problem. Effectively then we just blacklist those two variable names. Are we OK doing that?

StatusFileSize
new806 bytes
new6.51 KB
FAILED: [[SimpleTest]]: [MySQL] 55,898 pass(es), 583 fail(s), and 1,658 exception(s).
[ View ]

Let's agree on that.

Status:Needs review» Needs work

The last submitted patch, drupal-1998166-6.patch, failed testing.

Status:Needs work» Needs review

Let us go with #1 because it is safer.

Status:Needs review» Reviewed & tested by the community

#1 is RTBC

Status:Reviewed & tested by the community» Needs work

The last submitted patch, drupal-1998166-6.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new6.63 KB
PASSED: [[SimpleTest]]: [MySQL] 55,736 pass(es).
[ View ]

Just reupload the one in #1

Status:Needs review» Reviewed & tested by the community

This removes a HUGE DrupalWTF in that half of controllers can get Request $request, but not forms.

#11: drupal-1998166-11.patch queued for re-testing.

Status:Reviewed & tested by the community» Fixed

Committed 040ff57 and pushed to 8.x. Thanks!

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