Skip to content

Commit

Permalink
Reset fallback document after assigning it (#11858)
Browse files Browse the repository at this point in the history
* Reset fallback document after assigning it

A problem occurs in some special cases, i.e. when a cli script or some long running processes perform subsequent requests like so:

```
$kernel   = Kernel::get();
$request  = Request::create($somePath, 'GET');
$response = $kernel->handle($request);
```

The problem is that in the above use case the document once assigned in line 119 will be used in subsequent calls. That will overwrite an already correctly set document in the DocumentResolver in line 159.

When the fallback document is set to `null` afterwards, that won't happen.

* fix missing semicolon
  • Loading branch information
xlttj authored and brusch committed Apr 22, 2022
1 parent f351068 commit f29d3b2
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -157,6 +157,7 @@ public function onKernelController(ControllerEvent $event)

if ($this->fallbackDocument && $event->isMainRequest()) {
$this->documentResolver->setDocument($event->getRequest(), $this->fallbackDocument);
$this->fallbackDocument = null;
}
}
}

0 comments on commit f29d3b2

Please sign in to comment.