Issue #3043471 by longwave, catch, Wim Leers, xjm: Replace the DiactorosFactory message factory in symfony/psr-http-message-bridge with a PSR-17 compliant message factory

merge-requests/2419/head
Alex Pott 2020-03-11 13:56:53 +00:00
parent ba351b47cf
commit 05b122f2cb
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
6 changed files with 31 additions and 20 deletions

19
composer.lock generated
View File

@ -457,7 +457,7 @@
"dist": { "dist": {
"type": "path", "type": "path",
"url": "core", "url": "core",
"reference": "1135d82ca80e22e7f25b1bd9a8613cae5ae06372" "reference": "768f1baa1d20571f5f326b64ec749ddd5d1039fc"
}, },
"require": { "require": {
"asm89/stack-cors": "^1.1", "asm89/stack-cors": "^1.1",
@ -494,7 +494,7 @@
"symfony/http-kernel": "^4.4", "symfony/http-kernel": "^4.4",
"symfony/polyfill-iconv": "^1.0", "symfony/polyfill-iconv": "^1.0",
"symfony/process": "^4.4", "symfony/process": "^4.4",
"symfony/psr-http-message-bridge": "^1.2.0", "symfony/psr-http-message-bridge": "^2.0",
"symfony/routing": "^4.4", "symfony/routing": "^4.4",
"symfony/serializer": "^4.4", "symfony/serializer": "^4.4",
"symfony/translation": "^4.4", "symfony/translation": "^4.4",
@ -2930,16 +2930,16 @@
}, },
{ {
"name": "symfony/psr-http-message-bridge", "name": "symfony/psr-http-message-bridge",
"version": "v1.3.0", "version": "v2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/psr-http-message-bridge.git", "url": "https://github.com/symfony/psr-http-message-bridge.git",
"reference": "9d3e80d54d9ae747ad573cad796e8e247df7b796" "reference": "ce709cd9c90872c08c2427b45739d5f3c781ab4f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/9d3e80d54d9ae747ad573cad796e8e247df7b796", "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/ce709cd9c90872c08c2427b45739d5f3c781ab4f",
"reference": "9d3e80d54d9ae747ad573cad796e8e247df7b796", "reference": "ce709cd9c90872c08c2427b45739d5f3c781ab4f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2949,8 +2949,7 @@
}, },
"require-dev": { "require-dev": {
"nyholm/psr7": "^1.1", "nyholm/psr7": "^1.1",
"symfony/phpunit-bridge": "^4.4 || ^5.0", "symfony/phpunit-bridge": "^4.4 || ^5.0"
"zendframework/zend-diactoros": "^1.4.1 || ^2.0"
}, },
"suggest": { "suggest": {
"nyholm/psr7": "For a super lightweight PSR-7/17 implementation" "nyholm/psr7": "For a super lightweight PSR-7/17 implementation"
@ -2958,7 +2957,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3-dev" "dev-master": "2.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -2991,7 +2990,7 @@
"psr-17", "psr-17",
"psr-7" "psr-7"
], ],
"time": "2019-11-25T19:33:50+00:00" "time": "2020-01-02T08:07:11+00:00"
}, },
{ {
"name": "symfony/routing", "name": "symfony/routing",

View File

@ -51,7 +51,7 @@
"symfony/polyfill-php72": "v1.14.0", "symfony/polyfill-php72": "v1.14.0",
"symfony/polyfill-php73": "v1.14.0", "symfony/polyfill-php73": "v1.14.0",
"symfony/process": "v4.4.4", "symfony/process": "v4.4.4",
"symfony/psr-http-message-bridge": "v1.3.0", "symfony/psr-http-message-bridge": "v2.0.0",
"symfony/routing": "v4.4.4", "symfony/routing": "v4.4.4",
"symfony/serializer": "v4.4.4", "symfony/serializer": "v4.4.4",
"symfony/service-contracts": "v2.0.1", "symfony/service-contracts": "v2.0.1",

View File

@ -40,7 +40,7 @@
"stack/builder": "^1.0", "stack/builder": "^1.0",
"egulias/email-validator": "^2.0", "egulias/email-validator": "^2.0",
"masterminds/html5": "^2.1", "masterminds/html5": "^2.1",
"symfony/psr-http-message-bridge": "^1.2.0", "symfony/psr-http-message-bridge": "^2.0",
"laminas/laminas-diactoros": "^2.1", "laminas/laminas-diactoros": "^2.1",
"composer/semver": "^1.0", "composer/semver": "^1.0",
"asm89/stack-cors": "^1.1", "asm89/stack-cors": "^1.1",

View File

@ -786,8 +786,21 @@ services:
- { name: http_middleware, priority: 250 } - { name: http_middleware, priority: 250 }
psr7.http_foundation_factory: psr7.http_foundation_factory:
class: Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory class: Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory
psr17.server_request_factory:
class: Laminas\Diactoros\ServerRequestFactory
public: false
psr17.stream_factory:
class: Laminas\Diactoros\StreamFactory
public: false
psr17.uploaded_file_factory:
class: Laminas\Diactoros\UploadedFileFactory
public: false
psr17.response_factory:
class: Laminas\Diactoros\ResponseFactory
public: false
psr7.http_message_factory: psr7.http_message_factory:
class: Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory class: Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory
arguments: ['@psr17.server_request_factory', '@psr17.stream_factory', '@psr17.uploaded_file_factory', '@psr17.response_factory']
language_manager: language_manager:
class: Drupal\Core\Language\LanguageManager class: Drupal\Core\Language\LanguageManager
arguments: ['@language.default'] arguments: ['@language.default']

View File

@ -12,12 +12,16 @@ use Drupal\Core\DependencyInjection\ClassResolver;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Laminas\Diactoros\ResponseFactory;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\Diactoros\StreamFactory;
use Laminas\Diactoros\UploadedFileFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
/** /**
@ -56,7 +60,7 @@ class ControllerResolverTest extends UnitTestCase {
$this->container = new ContainerBuilder(); $this->container = new ContainerBuilder();
$class_resolver = new ClassResolver(); $class_resolver = new ClassResolver();
$class_resolver->setContainer($this->container); $class_resolver->setContainer($this->container);
$this->httpMessageFactory = new DiactorosFactory(); $this->httpMessageFactory = new PsrHttpFactory(new ServerRequestFactory(), new StreamFactory(), new UploadedFileFactory(), new ResponseFactory());
$this->controllerResolver = new ControllerResolver($this->httpMessageFactory, $class_resolver); $this->controllerResolver = new ControllerResolver($this->httpMessageFactory, $class_resolver);
} }

View File

@ -139,11 +139,6 @@ trait DeprecationListenerTrait {
return [ return [
// The following deprecation message is skipped for testing purposes. // The following deprecation message is skipped for testing purposes.
'\Drupal\Tests\SkippedDeprecationTest deprecation', '\Drupal\Tests\SkippedDeprecationTest deprecation',
// These deprecations are triggered by symfony/psr-http-message-factory
// 1.2, which can be installed if you update dependencies on php 7 or
// higher.
'The "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead.',
'The "psr7.http_message_factory" service relies on the deprecated "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class. It should either be deprecated or its implementation upgraded.',
// This deprecation comes from behat/mink-browserkit-driver when updating // This deprecation comes from behat/mink-browserkit-driver when updating
// symfony/browser-kit to 4.3+. // symfony/browser-kit to 4.3+.
'The "Symfony\Component\BrowserKit\Response::getStatus()" method is deprecated since Symfony 4.3, use getStatusCode() instead.', 'The "Symfony\Component\BrowserKit\Response::getStatus()" method is deprecated since Symfony 4.3, use getStatusCode() instead.',