Problem/Motivation

PHPStan, PHPCS and PHPUnit are all failing on Drupal core 11.3.

Steps to reproduce

See pipeline.

Proposed resolution

Fix all the things.

Remaining tasks

User interface changes

N/a

API changes

No

Data model changes

N/a

Issue fork redirect-3567073

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

liam morland made their first commit to this issue’s fork.

liam morland’s picture

I made a small change so that it is using version_compare() instead of float comparison. This matches other similar code in the module. I think there should be a comment explaining why the code is different starting in Drupal 11.3.

alexpott’s picture

liam morland’s picture

Status: Active » Needs review

The previous-version tests are passing, so I think this can be merged once the comment I refer to in #5 has been added.

alexpott’s picture

@liam morland FWIW I find the float version easier to read because the operator is in the correct place (in my head). They're functionally equivalent with respect to \Drupal::VERSION

alexpott’s picture

FWIW I'm not convinced about adding a comment - if we were doing completely different logic sure but this is just no calling a no-op function that is deprecated. Therefore the next thing once redirect's minimum version is greater than 11.3 is just to remove this code. The comment is not really helping anyone.

liam morland’s picture

So does the ::setCacheKey() call happen automatically in ::onKernelController() in 11.3?

alexpott’s picture

@liam morland nope - the whole cache is dead in 11.3 - it is replaced by fibers kinda.

liam morland’s picture

That could be put into the comment. Anytime I see different code paths for different versions, I wonder why it is.

berdir’s picture

Status: Needs review » Needs work

I think I'd prefer an inline @phpstan-ignore-next line comment over the baseline. That will be easier to adjust once we require 11.3 and remove that call.

Not sure a version check is needed at all, I explicitly requested for that deprecation to be D13, but if we have to touch it anyway thanks to phpstan then we can add it, I prefer compare_version() too. And it avoids the runtime deprecation. As for a comment, no strong feelings, we could slightly adjust the existing one, but it doesn't really matter for this call _why_ it's deprecated. The actual reasons are fairly complex, it's not just because of fibers, it's more that render caching removed much of it's usefulness ages ago as it heavily depends on render cache hit rates how many aliases are needed on a given page and it either loads too much or not enough. But there's no reason to write half a book on that in this module.

liam morland’s picture

I don't think there needs to be half a book. But consider this:

if (version_compare(\Drupal::VERSION, '11.3', '<')) {
  do_the_thing();
}
else {
  \Drupal::service('thing_service')->doTheThing();
}

It's clear what happened here: A procedural function was replaced by a service; no comment needed. But in the merge request, there is no else; the code has no replacement and, for me, that calls for some sort of explanation.

alexpott’s picture

Status: Needs work » Needs review

Added a comment.

I moved the tests to test against 11.3.x and not a tagged version (imo this should be the default behaviour anyway) but we can remove that when the core fix goes into a tagged release. I also added next minor testing to perhaps give us the chance of finding this earlier.

berdir’s picture

not against next testing in the MR, the project has a weekly next testing, that was my attempt at dealing with this. The problem is that as long as next branches are not set to fail, I don't get notifications (plus, I tend to get a ton of notifications, for example with the recent previous minor composer issues).

I think what I'd prefer is having next minor set to fail and not just warn so I get e-mails if it starts to break and have them on merge request as a manual job. I haven't verified if that's easily possibly yet. I also had this vague idea of building a dashboard of all my contrib projects and their CI status, specifically on next.

alexpott’s picture

If phpunit next minor fails - you'd get an email. no? I only suppress phpstan for next minor because they will generate noise and I think it is preferable to deal with that all at once. i.e. just when the next minor is actually released.

berdir’s picture

> If phpunit next minor fails - you'd get an email. no?

No because next minor is allowed to fail, so it's just a warning and that doesn't send a mail. We'd need to flip the allow_failure flag: https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes...

But then I wouldn't want to run it on merge requests as that would result in exactly the problem we have right now, it interferes with merge requests.

alexpott’s picture

Okay I'll remove the next minor stuff here and we can address this in the way you want in another issue. You have the scheduled job so that seems fine I guess.

  • berdir committed ada642c5 on 8.x-1.x authored by alexpott
    fix: #3567073 Fix pipeline on Drupal core 11.3
    
    By: alexpott
    By: liam...
berdir’s picture

Status: Needs review » Fixed

Thanks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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