Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
web/vendor/symfony/psr-http-message-bridge/Factory
|
@ -45,11 +45,11 @@ class DiactorosFactory implements HttpMessageFactoryInterface
|
|||
$server = DiactorosRequestFactory::normalizeServer($symfonyRequest->server->all());
|
||||
$headers = $symfonyRequest->headers->all();
|
||||
|
||||
try {
|
||||
$body = new DiactorosStream($symfonyRequest->getContent(true));
|
||||
} catch (\LogicException $e) {
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
$body = new DiactorosStream('php://temp', 'wb+');
|
||||
$body->write($symfonyRequest->getContent());
|
||||
} else {
|
||||
$body = new DiactorosStream($symfonyRequest->getContent(true));
|
||||
}
|
||||
|
||||
$request = new ServerRequest(
|
||||
|
@ -86,6 +86,10 @@ class DiactorosFactory implements HttpMessageFactoryInterface
|
|||
$files = array();
|
||||
|
||||
foreach ($uploadedFiles as $key => $value) {
|
||||
if (null === $value) {
|
||||
$files[$key] = new DiactorosUploadedFile(null, 0, UPLOAD_ERR_NO_FILE, null, null);
|
||||
continue;
|
||||
}
|
||||
if ($value instanceof UploadedFile) {
|
||||
$files[$key] = $this->createUploadedFile($value);
|
||||
} else {
|
||||
|
@ -107,7 +111,7 @@ class DiactorosFactory implements HttpMessageFactoryInterface
|
|||
{
|
||||
return new DiactorosUploadedFile(
|
||||
$symfonyUploadedFile->getRealPath(),
|
||||
$symfonyUploadedFile->getSize(),
|
||||
$symfonyUploadedFile->getClientSize(),
|
||||
$symfonyUploadedFile->getError(),
|
||||
$symfonyUploadedFile->getClientOriginalName(),
|
||||
$symfonyUploadedFile->getClientMimeType()
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Symfony\Bridge\PsrHttpMessage\Factory;
|
|||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\UploadedFileInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
@ -32,6 +33,20 @@ class HttpFoundationFactory implements HttpFoundationFactoryInterface
|
|||
*/
|
||||
public function createRequest(ServerRequestInterface $psrRequest)
|
||||
{
|
||||
$server = array();
|
||||
$uri = $psrRequest->getUri();
|
||||
|
||||
if ($uri instanceof UriInterface) {
|
||||
$server['SERVER_NAME'] = $uri->getHost();
|
||||
$server['SERVER_PORT'] = $uri->getPort();
|
||||
$server['REQUEST_URI'] = $uri->getPath();
|
||||
$server['QUERY_STRING'] = $uri->getQuery();
|
||||
}
|
||||
|
||||
$server['REQUEST_METHOD'] = $psrRequest->getMethod();
|
||||
|
||||
$server = array_replace($server, $psrRequest->getServerParams());
|
||||
|
||||
$parsedBody = $psrRequest->getParsedBody();
|
||||
$parsedBody = is_array($parsedBody) ? $parsedBody : array();
|
||||
|
||||
|
@ -41,7 +56,7 @@ class HttpFoundationFactory implements HttpFoundationFactoryInterface
|
|||
$psrRequest->getAttributes(),
|
||||
$psrRequest->getCookieParams(),
|
||||
$this->getFiles($psrRequest->getUploadedFiles()),
|
||||
$psrRequest->getServerParams(),
|
||||
$server,
|
||||
$psrRequest->getBody()->__toString()
|
||||
);
|
||||
$request->headers->replace($psrRequest->getHeaders());
|
||||
|
@ -80,10 +95,14 @@ class HttpFoundationFactory implements HttpFoundationFactoryInterface
|
|||
*/
|
||||
private function createUploadedFile(UploadedFileInterface $psrUploadedFile)
|
||||
{
|
||||
$temporaryPath = $this->getTemporaryPath();
|
||||
$psrUploadedFile->moveTo($temporaryPath);
|
||||
$temporaryPath = '';
|
||||
$clientFileName = '';
|
||||
if (UPLOAD_ERR_NO_FILE !== $psrUploadedFile->getError()) {
|
||||
$temporaryPath = $this->getTemporaryPath();
|
||||
$psrUploadedFile->moveTo($temporaryPath);
|
||||
|
||||
$clientFileName = $psrUploadedFile->getClientFilename();
|
||||
$clientFileName = $psrUploadedFile->getClientFilename();
|
||||
}
|
||||
|
||||
return new UploadedFile(
|
||||
$temporaryPath,
|
||||
|
|
Reference in a new issue