Problem/Motivation

As we learned in #3087531: Use Diactoros LTS version 1.7, not 1.8 which is out of security coverage and from the maintainers, the information documented on their Support and LTS support policy is somewhat misleading, but the 2.x major version will eventually include some LTS minor that should be supported throughout D9's lifetime.

Also in the meantime the Zend framework has been the Laminas framework.

laminas/laminas-diactoros 2.2 is currently available and requires PHP 7.1, so should be compatible with Drupal 9.0.

Proposed resolution

  • Update Drupal 9 to the latest version of laminas/laminas-diactoros

laminas/laminas-diactoros 2.x brings with it a new dependency: psr/http-factory. This is the set of interfaces required for the PSR-17 HTTP Factories standard, provided and maintained by PHP-FIG and documented at https://www.php-fig.org/psr/psr-17/. It has no new dependencies; only PHP 7 and psr/http-message:^1.0, which is already a dependency of other packages we use. It is not expected to receive any updates, security or otherwise. Therefore, I think this is safe to include as a sub-dependency of Drupal core.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

The dependency laminas/laminas-diactoros has been upgraded to version 2.2.2 which will allow us to support it through Drupal 9's lifetime.

Comments

xjm created an issue. See original summary.

traviscarden’s picture

Status: Active » Needs review
StatusFileSize
new503 bytes

Here we go...

traviscarden’s picture

Status: Needs review » Needs work

Oops. This suffers from the same problem described here #3104353: Upgrade to Guzzle 7

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new6.87 KB

Following the instructions in https://www.drupal.org/node/3089540, from a fresh checkout:

$ composer install
$ curl https://www.drupal.org/files/issues/2020-01-06/3104354-2.patch | patch -p1
$ COMPOSER_ROOT_VERSION=9.0.x-dev composer update drupal/core zendframework/zend-diactoros

Resulting patch attached.

longwave’s picture

Title: Update Doctrine to 2.1 » Update Diactoros to 2.1
Issue summary: View changes

This is Diactoros, not Doctrine

berdir’s picture

> Update Doctrine to 2.1 » Update Diactoros to 2.1

Oh, this makes much more sense now, I was very confused about the multiple doctrine update issues ;)

traviscarden’s picture

Thanks, @longwave. This is more like what I expected.

$ composer-lock-diff --no-links
+------------------------------+-------+-------+
| Production Changes           | From  | To    |
+------------------------------+-------+-------+
| zendframework/zend-diactoros | 1.8.7 | 2.2.1 |
| psr/http-factory             | NEW   | 1.0.1 |
+------------------------------+-------+-------+

So the only side-effect is the addition of psr/http-factory, which is literally just interfaces and seems reasonable to me. But I'll let someone more knowledgeable in the matter RTBC this.

wim leers’s picture

longwave’s picture

psr/http-factory is the set of interfaces required for the PSR-17 HTTP Factories standard, provided and maintained by PHP-FIG and documented at https://www.php-fig.org/psr/psr-17/. It has no dependencies other than PHP 7 and psr/http-message:^1.0 (which is already a dependency of three other packages we use). It is not expected to receive any updates, security or otherwise.

wim leers’s picture

@longwave That's what I figured — but it's that kind of information that needs to be added to the issue summary to make it crystal clear for any community member to discover, and especially for framework managers and core committers :)

longwave’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Updated IS.

xjm’s picture

Going to get thoughts on whether we should do this first or the laminas conversions first.

In the meanwhile, here's the core dependency page: https://www.drupal.org/core/dependencies

We'll want to add psr/http-factory there. It looks like we're also missing the other PSR interface from the page so we can add both.

traviscarden’s picture

I added psr/http-factory and psr/http-messages to the core dependency page, but I couldn't find any publicly posted details on release cycles and security policies. So I left those cells blank and asked about them on the PHP-FIG mailing list. I'll add the missing details as soon as they're provided.

traviscarden’s picture

I received the following response and updated the core dependency page:

PSR specs basically don't change at all. Sometimes we release a .z release to fix a comment typo or something like that, but that's about it.

We just recently approved a new process to release BC or almost entirely BC versions of an interface. So far it's not been used, although I am trying it out with PSR-13. Any new releases there would follow semver very conservatively.

We don't really have a security release process for them, as they're just interfaces.

The util packages might. For those... we don't really have a formal process right now. We might want to look into that at some point, but as the code is generally just the boring mundane stuff the odds of there being a security issue in one of those is slim.

--Larry Garfield

xjm’s picture

Title: Update Diactoros to 2.1 » [PP-1] Update Diactoros to 2.1
Status: Needs review » Postponed

Thanks @TravisCarden! I'll work on documenting that further on the page.

Discussed with @catch whether we should complete this or #3104015: Replace ZendFramework/* dependencies with their Laminas equivalents first, since they will conflict. @catch suggested doing the other first since that way the backport is more straightforward for that issue. So postponing on #3104015: Replace ZendFramework/* dependencies with their Laminas equivalents.

traviscarden’s picture

#3104015: Replace ZendFramework/* dependencies with their Laminas equivalents, which looks like it will remove Diactoros altogether, should render this issue obsolete.

@xjm, I'll add more detail to the dependencies page.

xjm’s picture

#3104015: Replace ZendFramework/* dependencies by their Laminas equivalents, which looks like it will remove Diactoros altogether, should render this issue obsolete.

Hm? 🤔 I don't think it does. Drupal fails hard without Diactoros; the whole HTTP request system or something depends on it as our PSR-7 implementation. It's removed as a dev dependency of one package but Drupal itself still depends on it. We explored replacing it prior to the 8.8 beta deadline and decided we needed to keep it.

traviscarden’s picture

Oh, I was imprecise. I meant that zendframework/zend-diactoros is removed, being replaced by laminas/zend-diactoros. But you're right, @xjm: the version won't be updated in the other issue, so we'll still need to do this.

traviscarden’s picture

Re: #15, I expanded the Core dependency documentation page to include the details from #14.

alexpott’s picture

Status: Postponed » Needs work

The laminas issue has landed - we can now upgrade the laminas components here.

longwave’s picture

Title: [PP-1] Update Diactoros to 2.1 » Update Diactoros to 2.1
Status: Needs work » Needs review
StatusFileSize
new6.68 KB
$ composer-lock-diff --no-links
+---------------------------+-------+-------+
| Production Changes        | From  | To    |
+---------------------------+-------+-------+
| laminas/laminas-diactoros | 1.8.7 | 2.2.2 |
| psr/http-factory          | NEW   | 1.0.1 |
+---------------------------+-------+-------+
longwave’s picture

Title: Update Diactoros to 2.1 » Update Diactoros to 2.x
Issue summary: View changes

We actually get 2.2 here!

alexpott’s picture

As there are no code changes here can we update all the laminas components here? Doing updates one component at a time feels very piecemeal.

longwave’s picture

StatusFileSize
new8.15 KB

The Zend bridge can go up by a point release, but the rest are already at their latest versions (double checked at GitHub that there are no new major versions)

$ COMPOSER_ROOT_VERSION=9.0.x-dev composer update drupal/core laminas/laminas-diactoros laminas/laminas-escaper laminas/laminas-feed laminas/laminas-stdlib laminas/laminas-zendframework-bridge
...
$ composer-lock-diff --no-links
+--------------------------------------+-------+-------+
| Production Changes                   | From  | To    |
+--------------------------------------+-------+-------+
| laminas/laminas-diactoros            | 1.8.7 | 2.2.2 |
| laminas/laminas-zendframework-bridge | 1.0.0 | 1.0.1 |
| psr/http-factory                     | NEW   | 1.0.1 |
+--------------------------------------+-------+-------+
alexpott’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

@longwave yep I've just looked at composer show -i and https://framework.zend.com/long-term-support (still the easiest place to see the latest version numbers) and you're right. Nice one.

I've updated the issue summary to be more specific about which diactoros is being updated.

alexpott’s picture

Title: Update Diactoros to 2.x » Update Laminas components including Diactoros
catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a re-roll (probably due to the PHP 7.3 patch).

longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new8.5 KB
catch’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC (but waiting for the bot to come back green).

xjm’s picture

+++ b/composer.lock
@@ -4041,9 +4102,6 @@
-            "bin": [
-                "bin/composer"
-            ],

Is this removal supposed to be in the patch? I have a feeling of déja vu about it.

xjm’s picture

Disregard #30; it's actually just a part of the http-message update and I just misread the indentation.

  • xjm committed 67fe88b on 9.0.x
    Issue #3104354 by longwave, TravisCarden, xjm, catch, alexpott, Wim...
xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +9.0.0 release notes

I applied the patch locally, and verified it was copacetic for all the various things with an extra composer install and composer update --lock. No diff from the patch.

Committed and pushed to 9.0.x. Thanks! Tagging for the release notes.

alexpott’s picture

@xjm #30 is correct - this has been seen before - that part of the diff is part of the composer/composer info in the lock file. We're removing the bin directory from composer in \Drupal\Composer\Plugin\VendorHardening\Config::$defaultConfig so there's nothing to link so vendor/bin doesn't contain composer. So I think it is fine to remove it - it's meaningless and if it comes back it doesn't really matter either. I've tried regenerating the patch and this is always getting removing using the latest stable version of composer. So I'd leave this removal in - it's not going to cause problems.

Status: Fixed » Closed (fixed)

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