Problem/Motivation
In July 2018, PHP-FIG accepted PSR-17, providing a standard interface to http message factories. The interface for this standard requires PHP 7.0, and most implementations require PHP 7.1. The symfony/psr-http-message-bridge provides a wrapper interface around the message factory, and can be used with our current DiactorosFactory or with PSR-17 compliant factories. Beginning with psr-http-message-bridge v1.2, the non-PSR-17 Diactoros factory is deprecated, in favor of the PsrHttpFactory, which uses PSR-17 factories under the hood.
Proposed resolution
laminas/laminas-diactoros provides a set of PSR-17 standard factories beginning with version 2.0, which can be plugged into the symfony PsrHttpFactory wrapper, however version 2.0 requires PHP 7.1. We should consider switching when we also support a PHP minimum version of 7.1. Because the symfony wrappers have the same interface, there are no BC concerns, and we could do this in Drupal 8.9 if we choose to support a minimum PHP version of 7.1 in Drupal 8.9. Alternatively this could be targeted for Drupal 9.0
A test of this swapout was done in #3039584: The "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead. and it was found that a direct swap resulted in passed tests with minimal code adjustments
Remaining tasks
Update the vender versions,
Add services for the individual factories
Replace the current factory service with the new service, and pass in the individual factory service
Remove deprecation suppression messages regarding DiactorosFactory being deprecated in symfony/psr-http-message-bridge v1.2
User interface changes
none
API changes
Our message factory would use PSR-17 factories under the hood to build our PSR-7 messages
Data model changes
none
Release notes snippet
Drupal 9 has updated symfony/psr-http-message-bridge to version 2.0.0 so it now uses PSR-17 compliant message factories to create PSR-7 requests and responses. See https://www.drupal.org/node/3119204
Comment | File | Size | Author |
---|---|---|---|
#30 | 3043471-30.patch | 7.91 KB | alexpott |
#27 | interdiff.3043471.22-27.txt | 872 bytes | longwave |
#27 | 3043471-27.patch | 7.91 KB | longwave |
Comments
Comment #2
tim.plunkettNot clear what this is postponed on, sorry if I'm missing something.
Comment #3
mikelutzI had it postponed on PHP 7.1 as a minimum supported version.
Comment #4
xjmWill this issue allow us to drop Diactoros as a dependency?
Comment #5
catchAt the moment this is for updating to zend-diactoros 2.* rather than replacing it.
Comment #6
Wim LeersPer #2917655-44: [9.4.x only] Drop official PHP 7.3 support in Drupal 9.4, it now seems likely that Drupal 8.9 will require PHP 7.1.
Once that becomes not just likely but fact, this would become unblocked (per #3, this has been blocked on PHP 7.1 being the minimum version). But it'd then still be blocked on the
8.9.x
branch opening.Comment #7
Wim Leers#2917655-48: [9.4.x only] Drop official PHP 7.3 support in Drupal 9.4 makes it sound less likely again that Drupal 8.9 will require PHP 7.1, which would block this.
Comment #8
Wim LeersComment #9
Wim LeersFixing typo in title, and updating status to make it more clear this is blocked on Drupal core requiring PHP 7.1 as its minimum version.
Comment #11
andypost7.2 at least required for 9.0 and related issue filed
Comment #12
BerdirComment #13
longwaveThis is fixed by #3104354: Update Laminas components including Diactoros I think?
Comment #14
longwaveFollowing #3104015: Replace ZendFramework/* dependencies with their Laminas equivalents this patch takes the upgrade in #3104354: Update Laminas components including Diactoros and work in #3039584: The "Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead. and also upgrades symfony/psr-http-message-bridge to v2.0.0 for good measure. As we need to change service definitions here, for full compatibility with 8.9 can this be committed to 9.0 or do we have to wait until 9.1?
Comment #15
catchI don't see a reason here to wait until 9.1.x to commit this, there's no API change really, but Berdir moved it up to 9.1 so may have views?
Comment #16
longwaveRerolled, and removed two skipped deprecations that are obsoleted by this patch.
Comment #17
longwaveReroll following commit of #3104354: Update Laminas components including Diactoros
Comment #18
longwaveSetting parent
Comment #19
andypostLooks ready except RM-appproval
Comment #20
longwaveReroll
Comment #21
xjmThis part at least seems totally non-controversial to do in 9.0.x if it's done in time for beta.
It's still possible that this could be disruptive and might need the same thorough testing Wim did previously? Maybe we could split it into a separate issue?
In general, I'd also want to know what Symfony's long-term support plans are for the message bridge, since it's versioned separately from the rest of the Symfony components.
Comment #22
longwaveThanks for the review!
#21.2 has to be done if we do #21.1, as DiactorosFactory is removed in symfony/psr-http-message-bridge 2.0.0; this is the backward incompatible part.
Note that this patch also removes two deprecation messages - the DiactorosFactory is considered deprecated, hence its removal in 2.0.0. I don't know Symfony's plans but I can only assume that 2.x will be supported better than 1.x going forwards.
Rerolled patch attached, as composer.lock has changed and the other parts have fuzzed a bit.
Comment #23
catchI don't think we're using it yet, but these seem like good candidates for defining as internal service definitions.
Comment #24
longwave> I don't think we're using it yet, but these seem like good candidates for defining as internal service definitions.
We can set
public: false
on these I think?Comment #25
catchThat sounds good, moving to needs work for that change.
Symfony contracts also has a different version number to the other Symfony components, see https://github.com/symfony/contracts/releases
I assume they're doing this for any new components that are self-contained (but which might be new dependencies for other parts of Symfony, which contracts definitely is).
Comment #26
catchComment #27
longwaveChanged the new services to be
public: false
Comment #28
catchThanks I think that's all that's left here.
Comment #29
alexpottUpdating the issue summary so it references laminas/laminas-diactoros and not zend.
Comment #30
alexpottRerolled as #3117558: 9.0.x core's hash in composer.lock is wrong landed ... the only difference is
Comment #31
catchOpened a ticket to clarify the support cycle. Given we're already using this component I think it's fine to answer before that's answered, so untagging. (Also this doesn't really supply an API as such, so if we had to downgrade during beta due to bad news, it wouldn't be the worst thing, but having to downgrade is less likely than having to upgrade due to dropped support).
Comment #32
alexpottHere's the github issue to track support cycle https://github.com/symfony/psr-http-message-bridge/issues/76
I agree with @catch that getting onto v2 is good for D9 prior to beta.
Committed 05b122f and pushed to 9.0.x. Thanks!
Comment #34
alexpott