The end of FormSubmitter::redirectForm() currently has:
$url = $this->urlGenerator->generateFromPath($request->attributes->get('_system_path'), ...

Replace that by injecting $route_match into the constructor, and generating a URL using its route and raw parameters.

Comments

xjm’s picture

Priority: Normal » Major
Issue tags: +beta target
dawehner’s picture

Status: Active » Needs review
Issue tags: +PHPUnit
StatusFileSize
new6.08 KB

Here is one.

Status: Needs review » Needs work

The last submitted patch, 2: drupal-2293521-2.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new6.63 KB
new563 bytes

meh

Status: Needs review » Needs work

The last submitted patch, 4: form-2293521-4.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new6.93 KB
new1.04 KB

Reasons for this interdiff: ElementsTableSelectTest executes form processing code in a simpletest, so the route name is not set on the route match object.

Status: Needs review » Needs work

The last submitted patch, 6: form-2293521-6.patch, failed testing.

mgifford’s picture

Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
StatusFileSize
new6.83 KB

trying...

tim.plunkett’s picture

  1. +++ b/core/lib/Drupal/Core/Form/FormSubmitter.php
    @@ -137,19 +149,14 @@ public function redirectForm(FormStateInterface $form_state) {
    -    if ($url) {
    -      // According to RFC 7231, 303 See Other status code must be used to redirect
    -      // user agent (and not default 302 Found).
    -      // @see http://tools.ietf.org/html/rfc7231#section-6.4.4
    -      return new RedirectResponse($url, Response::HTTP_SEE_OTHER);
    ...
    +        return new RedirectResponse($url, Response::HTTP_SEE_OTHER);
    

    This still needs to be outside of that, left as-is. See the if() case above

  2. +++ b/core/lib/Drupal/Core/Form/FormSubmitter.php
    @@ -137,19 +149,14 @@ public function redirectForm(FormStateInterface $form_state) {
    +        $url = $this->urlGenerator->generateFromRoute($this->routeMatch->getRouteName(), $this->routeMatch->getRawParameters()
    +          ->all(), array(
    +          'query' => $request->query->all(),
    +          'absolute' => TRUE,
    +        ));
    

    This should be in the elseif

rpayanm’s picture

StatusFileSize
new6.3 KB

@tim.plunkett thank you.
here the patch

Status: Needs review » Needs work

The last submitted patch, 11: 2293521-11.patch, failed testing.

The last submitted patch, 9: 2293521-9.patch, failed testing.

mgifford’s picture

So PHP Fatal error introduced in:

+      $url = $this->urlGenerator->generateFromRoute($this->routeMatch->getRouteName(), $this->routeMatch->getRawParameters()
+        ->all(), array(

Ok, so what has all() been replaced with in getRawParameters()?

sidharrell’s picture

StatusFileSize
new10.83 KB
new1.28 KB

@rpayanm you should really install dreditor, the browser extension. It'll give you a button in the files section where you go to upload your patch with a "patchname suggestion" button. It'll help give you a standard patchname for the issue. Not to pick on you, the other two prior posters didn't use it either, it's just getting to be a pet peeve. If we all just used the patchname suggestion button, it would make creating the interdiffs so much easier.
And that is one thing you really should do, @rpayanm, when submitting patchs, is submit a corresponding interdiff at the same time. It helps everyone who is following the issue.
Attaching interdiffs from 6 to 9, and 9 to 11.

sidharrell’s picture

Straight reroll of #11.
Let us see where Testbot is the most angry.

sidharrell’s picture

Status: Needs work » Needs review

drink Druplicon!

Status: Needs review » Needs work

The last submitted patch, 16: use_route_name_and-2293521-16.patch, failed testing.

dawehner’s picture

Status: Needs work » Closed (duplicate)

Sorry but this is basically a duplicate of #2372507: Remove _system_path from $request->attributes :(

Status: Closed (duplicate) » Needs work

The last submitted patch, 16: use_route_name_and-2293521-16.patch, failed testing.

sidharrell’s picture

Status: Needs work » Closed (duplicate)