I had a similar problem .
The solution is to try to access the RequestStack object as long as possible to give the kernel the opportunity to populate it.
Essentially, do not try to access it in the constructor.
I moved his access to the method, which is called later, and he solved it for me.
private $requestStack;
public function __construct(RequestStack $request)
{
$this->requestStack = $request;
}
public function outputRequestStack() {
exit(var_dump($this->requestStack));
}
source
share