Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
From https://github.com/symfony/http-kernel/blob/5.x/HttpKernelInterface.php#...
/**
* @deprecated since symfony/http-kernel 5.3, use MAIN_REQUEST instead.
* To ease the migration, this constant won't be removed until Symfony 7.0.
*/
public const MASTER_REQUEST = self::MAIN_REQUEST;
Steps to reproduce
Proposed resolution
Add an FC (forward compatibility) layer, replace the constant.
Search for related instances of "master" in comments and replace them with "main" at the same time.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff_20-22.txt | 3.07 KB | murilohp |
#22 | 3209723-22.patch | 37.82 KB | murilohp |
|
Comments
Comment #2
catchI think we can take the same approach here as we have in #3209618: [Symfony 6] Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest() is deprecated, use isMainRequest() instead.
However also noting this:
If we just suppressed the deprecation message, then both core and modules could switch over during Drupal 10, the only issue then is that Drupal 9 + Drupal 11 compatibility wouldn't be possible.
Comment #3
longwaveI don't think there will be a deprecation message, as this is just a constant and so there is no code executed when it is used - this is why they are keeping it around until Symfony 7 I guess. I think we can probably just leave this one until the D10 cycle, there seems no pressing need to do it now with an FC layer.
Comment #4
andypostComment #5
andypostChecked usage and only
Kernel::handle()
with middlewares affected but 2/3 of (50) in tests could be easy replacedComment #7
daffie CreditAttribution: daffie commentedThe problem with this patch is that the constant is used as the default value for the paramter
$type
in the methodDrupal\Core\DrupalKernel::handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
. Therefor we cannot replace the constant in a minor version release, it must be done in a new major release. Moving this to be committed in D10.0.This issue is part of the get Symfony 6 in D10 and therefor it is a critical issue.
Comment #8
daffie CreditAttribution: daffie commentedAdded a CR.
Comment #9
catchCan't we make the change everywhere except
Drupal\Core\DrupalKernel::handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE).
and open a follow-up for that one method to do in Drupal 10?On the other hand Symfony itself won't drop the old constant until Symfony 7, so there is not the same urgency here as other Symfony 6 changes.
Comment #10
daffie CreditAttribution: daffie commentedThat is why I wanted to wait for the 10.0 branch to commit this patch.
Comment #11
longwave@catch we need an FC layer to do that in Drupal 9 as the constant doesn't exist in Symfony 4. IMO this should just be postponed, we're only making work for ourselves trying to fit it in now if we can wait until we are on Symfony 6.
Comment #12
catchOh good point we'd have to add a shim, yeah let's leave this for Drupal 10 then.
Comment #13
longwaveComment #14
daffie CreditAttribution: daffie commentedUnpostponing as the 10.0.x branch is open.
Comment #15
daffie CreditAttribution: daffie commentedComment #16
murilohp CreditAttribution: murilohp at CI&T commentedHere's the reroll of patch #7 to branch 10.0.x.
Comment #17
longwaveThis still can't go in until at least Symfony 5.4 is committed.
Comment #18
SpokjePostponing on #3197482: Update Drupal 10 to depend on Symfony 5.4 (as a stepping stone to Symfony 6, for deprecation checking support) as stated in #17
Comment #19
murilohp CreditAttribution: murilohp at CI&T commentedThe #3197482 landed! I rerolled #16, let's see now.
Comment #20
murilohp CreditAttribution: murilohp at CI&T commentedFixing the coding standard errors. I accidentally added a new empty file.
Comment #21
longwaveNearly there, two cases missing that I can see:
Comment #22
murilohp CreditAttribution: murilohp at CI&T commentedThanks for the review @longwave! Addressing #21 on this new patch.
Comment #23
daffie CreditAttribution: daffie commentedAll code changes look good to me.
I have installed the patch on my local machine and I could not find any more instances of the old constant.
The IS and the CR are in order.
For me it is RTBC.
Comment #25
catchCommitted 7f93a36 and pushed to 10.0.x. Thanks!
Current status is that contrib modules won't be able to resolve the Symfony 5/6 deprecation until they drop support for Drupal 9.4, but we'll reach that point before the Drupal 11 branch opens and updates to Symfony 7. If Symfony was dropping this in Symfony 6, we'd need to add a shim to Drupal 9, but they're not.
Comment #27
quietone CreditAttribution: quietone at PreviousNext commentedUpdated and published the CR.