-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build request object within dispatcher if not already defined in container #26
Comments
This is something I've been thinking about recently and I think you're right, we should probably build the request object within the dispatcher if it has not already been defined. |
@ry167 I would wrap that in a closure: $container->add('Symfony\Component\HttpFoundation\Request', function () {
return Request::createFromGlobals();
}); |
Apologies for the delay in addressing this, for v1 I will be implementing a check for the whether the request has been instantiated properly or not and then building it if not. v2 wll handle it slightly differently as there is a change around the HTTP layer of dependencies. |
Fixed by 803cad3 |
In
RequestResponseStrategy.php
, whenSymfony\Component\HttpFoundation\Request
is fetched from the League Container, if it is not already set in the container then it will initiate a largely useless Request object that contains none of the globals that HttpFoundation Request is normally initiated with.I am not extremely familiar with Dependency Injection so I don't know what the ideal fix for this is in this package. When using Route in a project you can make a Service Provider for HttpFoundation or set it with
$container->add('Symfony\Component\HttpFoundation\Request', Request::createFromGlobals());
, but it was quite unexpected to have to do so.The text was updated successfully, but these errors were encountered: