-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
HttpFoundationhasPRA Pull Request has already been submitted for this issue.A Pull Request has already been submitted for this issue.
Description
In Overriding the request, we seem to confuse create
with __construct
from the Request.
They are not the same.
The following is not correct:
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Http\SpecialRequest;
Request::setFactory(function (
array $query = array(),
array $request = array(),
array $attributes = array(),
array $cookies = array(),
array $files = array(),
array $server = array(),
$content = null
) {
return SpecialRequest::create(
$query,
$request,
$attributes,
$cookies,
$files,
$server,
$content
);
});
$request = Request::createFromGlobals();
The following is correct:
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Http\SpecialRequest;
Request::setFactory(function (
array $query = array(),
array $request = array(),
array $attributes = array(),
array $cookies = array(),
array $files = array(),
array $server = array(),
$content = null
) {
return new SpecialRequest(
$query,
$request,
$attributes,
$cookies,
$files,
$server,
$content
);
});
$request = Request::createFromGlobals();
I have sent a PR
Metadata
Metadata
Assignees
Labels
HttpFoundationhasPRA Pull Request has already been submitted for this issue.A Pull Request has already been submitted for this issue.