Problem/Motivation

Composer updating symfony/psr-http-message-bridge to the newly released 1.2 throws new deprecation errors against testbot. While this version is not shipped in the current composer.lock file, as it requires PHP 7.0, sites are automatically updated to it when doing a composer update with a modern php version.

Proposed resolution

Suppress the deprecations for now, and add a follow-up to switch to the PsrHttpFactory when our minimum supported PHP version supports it.

Remaining tasks

commit it.

User interface changes

none

API changes

none

Data model changes

none

Release notes snippet

Comments

mikelutz created an issue. See original summary.

morbus iff’s picture

I'm seeing two messages in this vein, in 8.6.x when running php ./core/scripts/run-tests.sh --sqlite test.sqlite --url http://localhost:8888/ --browser standard:

Remaining deprecation notices (100) 55x: The "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead. 55x in StandardTest::testStandard from Drupal\Tests\standard\Functional 45x: 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. 45x in StandardTest::testStandard from Drupal\Tests\standard\Functional

morbus iff’s picture

Most immediate fix, like with the recent twig hiccups, is a downgrade:

composer require symfony/psr-http-message-bridge:1.1.1

mikelutz’s picture

I've found that that particular dependency has a requirement of php 7.1, which I didn’t realize when I made the issue yesterday, so it isn’t going to end up in our composer.lock file anytime soon, but it is being installed on my sites when I do composer update on a modern php version.

It's replacement seems to be available in 1.1.0 though, which is currently in the lock file, so perhaps we can start using it. Could it be this easy?

mikelutz’s picture

Status: Needs review » Needs work

Haha, not even close. It's not a direct replacement and requires more packages that do have php7 dependencies, so maybe it's something we can tackle in 8.8

mikelutz’s picture

mikelutz’s picture

Wow, I didn't really think that would work. It is good to know if we ever support a minium php version of 7.1 that we can swap out for a psr17 message factory that easily. Back to the issue at hand. Here's a patch showing the deprections if symfony/psr-http-message-bridge is updated to version 1.2. This should cause about 2600 failures. Also is a patch locking the version to 1.1 patch releases, in which the Diactoros message factory is not deprecated. I'm in favor of locking the version until our minimum php version supports a more modern alternative. I think we suppress more than enough deprecation notices right now.

The alternatives to locking the minor version of psr-http-message bridge are to suppress the deprecation notices, or to do nothing, and not update the dependency in the lock file, because 1.2 requires php 7.1. Up to the FMs what to do (if anything).

The last submitted patch, 7: 3039584-7.drupal.DO_NOT_TEST.patch, failed testing. View results

morbus iff’s picture

Fresh install of 8.6.11 today, with drupal-project defaults, has the 1.2.0 in it, causing most of my attempted tests to fail. Sniff.

mikelutz’s picture

That's odd, the composer lock file still has 1.1.0. Composer install should keep it there, but any composer update on php 7 or higher will install the new one.

mikelutz’s picture

It definitely broke my builds, until I forced the downgrade in my sites' composer.json. Jenkins runs updates on php 7.3 which was pulling in phmb 1.2, and then the project's phpunit tests were failing.

botris’s picture

Status: Needs review » Needs work

I don't think composer.lock is shipped in core and should probably not be in the patch.
If you use composer to install / manage Drupal, like through drupal-composer/drupal-project, then the patch also does not apply as the lock file will be outside the docroot/web/www folder.

I can confirm that specifying symfony/psr-http-message-bridge:1.1.1 does fix the problem.

mikelutz’s picture

Status: Needs work » Needs review

composer.lock is definitly part of the tagged release, and if we are going to upgrade to symfony/psr-http-message-bridge 1.1.1 in 8.8, then it is appropriate to add it to the composer.lock. The patch is made for a Drupal release, not to be applied to existing sites.

Although I've just noticed that 1.1.1 adds a new dev dependency that itself has a dependency of php7.1, so we may be stuck back with 1.1.0 after all. Queuing a test against php 7.0 and seeing if it breaks composer.

jibran’s picture

jibran’s picture

Status: Needs review » Closed (duplicate)
Issue tags: -Needs issue summary update
Related issues: +#3032693: Update core PHP dependencies before 8.7.0
mikelutz’s picture

Status: Closed (duplicate) » Needs review

Respectfully reopening because while we updated psr-http-message-factory to 1.1.1 in that issue, we didn't lock it to <1.2, which is what gets installed if you composer update with php7.0 or higher. The purpose of this issue is to lock it to <1.2 in composer.json or otherwise manage the deprecation errors that come up so sites that do run an update don't break or throw deprecation errors.

If this is truly something we don't want to do then we can close this. I know we technically only guarantee what's in the lock file, but if we know of an issue with a vendor update, we should handle it if we can, and we can here pretty easily.

jibran’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

if we know of an issue with a vendor update, we should handle it if we can, and we can here pretty easily.

I agree sorry for missing that. Let's not pin it in composer.json and make it compatible with both versions.

mikelutz’s picture

mikelutz’s picture

catch’s picture

Status: Needs review » Reviewed & tested by the community

Agreed, let's suppress the deprecations for this one. We should open another issue to discuss how to remove the deprecation suppression though, or is there already one open?

mikelutz’s picture

I don't think there is one open. Removing the deprecation suppression would mean replacing the message factory with a psr17 message factory once php 7.1 is the minimum supported version, I assume in Drupal 9.

catch’s picture

Technically Drupal 8.9 should require at least PHP 7.1, but we are still trying to drop PHP 5.5/5.6 support properly. I think we should open an 8.x issue for the follow-up even if turns out to be unresolvable before 9.x

mikelutz’s picture

catch’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed a3145544ae to 8.8.x and f3241f5402 to 8.7.x. Thanks!

  • catch committed 2f84076 on 8.8.x
    Issue #3039584 by mikelutz, Morbus Iff: The...

  • catch committed f3241f5 on 8.7.x
    Issue #3039584 by mikelutz, Morbus Iff: The...
dave reid’s picture

Any chance this could be cherry-picked to 8.6.x? We're running into this when using the latest 8.6.13 and the "strict" SYMFONY_DEPRECATIONS_HELPER setting.

jibran’s picture

RE:#27 You can always downgrade the package.

dave reid’s picture

I'd rather not add a downgrade requirement to each module's composer.json I need for our test system just for 8.6.x. Feels like this is a bug more than a task which means it could be fixed in the latest 8.6.x, but wasn't cherry-picked so I thought I would ask.

morbus iff’s picture

I'd also love a 8.6.x backport.

mikelutz’s picture

I'm not even sure that there will be another release in the 8.6 series before 8.7 is released and 8.6 becomes security-fixes only. Nothing has been committed to the 8.6 branch in the week since the 8.6.13 security release, and 8.7 is due in just over a month.

Either way, that backport is at the discretion of the committers.

gambry’s picture

StatusFileSize
new1.53 KB

Issue is now fixed, there is a solution for 8.6 on #27 so I don't think there will be a backport.
However here a reroll for 8.6.x if anyone want to patch while waiting for 8.7.
(Also committed patch misses a fullstop at the end of the comment.)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.