I ran the branch locally on Drupal 11.4.8 with PHP 8.4, ext-mongodb 1.21.10, mongodb/mongodb 1.21.5 and MongoDB 8.3: Unit, Kernel and Functional tests all pass, and it still merges cleanly into 8.x-2.x.

Before merging, please rebase on 8.x-2.x and trim the MR back to the Drupal 11 compatibility scope:

  • .gitlab-ci.yml: replace the extension build block with the original one-liner, pinned: pecl install mongodb-1.21.10 && docker-php-ext-enable mongodb. Only add build tools back if a job log shows they are actually missing.
  • composer.json: drop "prefer-stable": true. It was only there to avoid Twig 3.30, which core 11.4.8 now handles.
  • cspell: the docs updated in #3626482: Update docs site for 2026-09 bring new words (at least "Coveralls" and "daffie"): please add them to _CSPELL_WORDS.
  • Logger::eventCollections(): the switch from CollectionInfoIterator to \Iterator matches what Database::listCollections() documents in the 1.x library, and 8.x-2.2 will require 1.21, so it can stay, but please list it under "API changes" in the MR description.
  • MR description: the "Dependencies" section still says phpunit depends on #3542043: Allow compatibility with `ext-mongodb` version 2.0, which is no longer the case, and "API changes" is missing the eventCollections() signature change.

Please also include, since they define what 8.x-2.2 will claim to support:

  • Version floors, aligned with the currently supported core branches (10.6, 11.3, 11.4) and the versions this branch is tested with:
    • the three .info.yml: core_version_requirement: ^10.6 || ^11.3, and php: 8.1 instead of php: '8.x';
    • root composer.json: the drupal/core conflict becomes <10.6.0 || >=11.0 <11.3.0;
    • all four composer.json: ext-mongodb and mongodb/mongodb raised to ^1.21.
  • CI coverage for those claims, plus an early look at Drupal 12, in .gitlab-ci.yml:
    variables:
      OPT_IN_TEST_PREVIOUS_MAJOR: '1'
      OPT_IN_TEST_PREVIOUS_MINOR: '1'
      OPT_IN_TEST_NEXT_MAJOR: '1'
    
    composer (next major):
      allow_failure: true
    

    The templates already allow the next-major phpunit, phpstan and nightwatch jobs to fail, but not composer (next major), which the others depend on. They also rewrite core_version_requirement to ^12 during those jobs, so .info.yml does not need to claim it yet.

Follow-ups, not blocking this MR:

  • #3458044: [PHP 8.4] Fix implicitly nullable type declarations (PHP 8.4): the implicitly nullable $eventTemplate in DetailController::getTop(), and unset($this->queueFactory) in QueueTest::tearDown(), which Upgrade Status flags on PHP 8.4 and can become $this->queueFactory = NULL;.
  • Drupal 12 needs PHPUnit attributes: PHPUnit 12 no longer reads @covers, @group or @dataProvider. As long as Drupal 10 is supported, its PHPUnit 9 only reads annotations, so the attributes have to be added next to them, not instead of them. The Drush commands can move to attributes outright, since every Drush version 8.x-2.x accepts supports them.

Issue fork mongodb-3625939

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

matthand created an issue. See original summary.

matthand’s picture

I've pushed fixes for everything in the summary:

  • FormStateValueResolver now implements ValueResolverInterface, and ConfigForm passes $typedConfigManager to its parent. Both work on Drupal 10.5+ and 11.
  • Tests: replaced drupal_rewrite_settings() with SettingsEditor::rewrite(), fixed the QueueTest constructor call, made the data providers static, and added assertions to the unit LoggerTest.
  • Added drush/drush to require-dev. The template's own Drush install fails because it doesn't ignore the missing ext-mongodb, so PHPStan couldn't find DrushCommands.
  • Fixed the cspell typos, added project terms through _CSPELL_WORDS, and fixed the two stylelint findings.

matthand’s picture

Status: Active » Needs review

There was some small fixes to make to get it to pass CI. The latest Twig has a core bug in it, so had to pin that in CI for now. Will add followup ticket to remove that when the bug is fixed by core. I'll also check to see if it's reported there. But good news, all checks green! The 2.x modules install cleanly on Drupal 11! Ready for review!

matthand’s picture

Yeah the Twig 3.30.0 bug is reported and getting attention. I'll add the ticket to remove the workaround only if we merge the MR51 before the bug is fixed. Otherwise, I'll just remove workaround in the MR.

fgm’s picture

Thanks for this, and for splitting the CI fixes out of #3542043: Allow compatibility with `ext-mongodb` version 2.0.

Before review: was an AI tool used for the issue summary, the MR description or the code? d.o.'s AI policy asks for a short human-written disclosure at the end of the issue summary or MR description when it generated a significant part of either, however thoroughly it was reviewed. If none was used, just say so and I'll go ahead with the review.

matthand’s picture

Issue summary: View changes
matthand’s picture

Issue summary: View changes
matthand’s picture

@fgm, My bad I forgot to add the AI disclosure. Just updated the descriptions on this issue and on MR to disclose that I worked with Claude Code.

matthand’s picture

@fgm This Twig bug is so annoying, blocking CI. Somehow the Drupal Core constraint in the Drupal GitLab CI template is still 11.4.6 on their end, which will not build with Twig 3.30.0. I've now pinned CI to Drupal Core 11.4.8 since that was released to fix the Twig bug. If you want to handle the workaround another way let me know and I'll adjust. If you merge this sooner than this bug passes through all these layers I'll add the clean up ticket to remove the workaround when it's safe to do so.

fgm’s picture

Issue summary: View changes

I ran the branch locally on Drupal 11.4.8 with PHP 8.4, ext-mongodb 1.21.10, mongodb/mongodb 1.21.5 and MongoDB 8.3: Unit, Kernel and Functional tests all pass, and it still merges cleanly into 8.x-2.x.

Before merging, please rebase on 8.x-2.x and trim the MR back to the Drupal 11 compatibility scope:

  • .gitlab-ci.yml: replace the extension build block with the original one-liner, pinned: pecl install mongodb-1.21.10 && docker-php-ext-enable mongodb. Only add build tools back if a job log shows they are actually missing.
  • composer.json: drop "prefer-stable": true. It was only there to avoid Twig 3.30, which core 11.4.8 now handles.
  • cspell: the docs updated in #3626482: Update docs site for 2026-09 bring new words (at least "Coveralls" and "daffie"): please add them to _CSPELL_WORDS. Instead of the four "behaviour" to "behavior" edits in doc comments, please add behaviour to that list too.
  • Logger::eventCollections(): the switch from CollectionInfoIterator to \Iterator changes a public signature for library 2.x, so it belongs in #3542043: Allow compatibility with `ext-mongodb` version 2.0 rather than here.
  • MR description: the "Dependencies" section still says phpunit depends on #3542043: Allow compatibility with `ext-mongodb` version 2.0, which is no longer the case, and "API changes" should list any signature change that stays in this MR.

Please also include, since they define what 8.x-2.2 will claim to support:

  • Version floors, aligned with the currently supported core branches (10.6, 11.3, 11.4) and the versions this branch is tested with:
    • the three .info.yml: core_version_requirement: ^10.6 || ^11.3, and php: 8.1 instead of php: '8.x';
    • root composer.json: the drupal/core conflict becomes <10.6.0 || >=11.0 <11.3.0;
    • all four composer.json: ext-mongodb and mongodb/mongodb raised to ^1.21.
  • CI coverage for those claims, plus an early look at Drupal 12, in .gitlab-ci.yml:
    variables:
      OPT_IN_TEST_PREVIOUS_MAJOR: '1'
      OPT_IN_TEST_PREVIOUS_MINOR: '1'
      OPT_IN_TEST_NEXT_MAJOR: '1'
    
    composer (next major):
      allow_failure: true
    

    The templates already allow the next-major phpunit, phpstan and nightwatch jobs to fail, but not composer (next major), which the others depend on. They also rewrite core_version_requirement to ^12 during those jobs, so .info.yml does not need to claim it yet.

Follow-ups, not blocking this MR:

  • #3458044: [PHP 8.4] Fix implicitly nullable type declarations (PHP 8.4): the implicitly nullable $eventTemplate in DetailController::getTop(), and unset($this->queueFactory) in QueueTest::tearDown(), which Upgrade Status flags on PHP 8.4 and can become $this->queueFactory = NULL;.
  • Drupal 12 needs PHPUnit attributes: PHPUnit 12 no longer reads @covers, @group or @dataProvider. As long as Drupal 10 is supported, its PHPUnit 9 only reads annotations, so the attributes have to be added next to them, not instead of them. The Drush commands can move to attributes outright, since every Drush version 8.x-2.x accepts supports them.
fgm’s picture

Status: Needs review » Needs work
matthand’s picture

Status: Needs work » Needs review

@fgm Thanks for the review and the local test run. I've rebased on 8.x-2.x (now on top of f67afe8, the #3626482 docs update) and applied the feedback. A few items needed small changes once the CI logs came in, as explained below. The MR description is updated to match.

Requested changes

  • Twig 3.30 workaround: removed the DRUPAL_CORE: 11.4.8 override on the composer job, and "prefer-stable" is back to false.
  • cspell: added behaviour, behaviours, coveralls, coverallsapp, daffie, fontawesome and mkdocs to _CSPELL_WORDS, and reverted the "behavior" edits. I only found three, not four. behaviours is listed separately because cspell doesn't match plurals.
  • Logger::eventCollections(): the return type is back to CollectionInfoIterator, so there is no public signature change here. PHPStan then fails on it with return.deprecatedInterface, because the interface is deprecated in mongodb/mongodb 1.21. I ignored that one error on the method with @phpstan-ignore and added a @todo to change the type to \Iterator in #3542043.
  • Version floors: core_version_requirement: ^10.6 || ^11.3 and php: 8.1 in the .info.yml files. I also updated the mongodb_watchdog_test module's for consistency. The root drupal/core conflict is now &lt;10.6.0 || &gt;=11.0 &lt;11.3.0, and ext-mongodb and mongodb/mongodb are ^1.21 in all four composer.json files.
  • CI coverage: the three OPT_IN_TEST_* variables are set, and composer (next major) has allow_failure: true.
  • MR description: the Dependencies note on #3542043 is gone, and API changes now lists the raised minimum versions.

Changes the CI logs required

  • Extension install: I started from the one-liner pecl install mongodb-1.21.10 &amp;&amp; docker-php-ext-enable mongodb, but it needed three more pieces:
    • -f: the image already has a newer 2.x build, and pecl refused with "pecl/mongodb is already installed and is newer than detected released version 1.21.10".
    • Build tools: with -f, phpize failed with "Cannot find autoconf", so autoconf, build-essential and pkg-config are back, installed through apt.
    • A check that the extension is loaded: pecl exits 0 even when the build fails, so the tests ran anyway and all errored with Class "MongoDB\Driver\Manager" not found. The check now fails the job at the install step instead.
  • Autorun: the OPT_IN_TEST_* variables only add the variant jobs. With the templates' default _AUTORUN_*: none, they're manual jobs that contributors can't start in MR pipelines. I set _AUTORUN_PREVIOUS_MAJOR, _AUTORUN_PREVIOUS_MINOR and _AUTORUN_NEXT_MAJOR to push-and-mr. If you'd rather keep them manual, I can drop this.
  • PHPUnit constraint: composer (previous major) couldn't resolve phpunit/phpunit: ^11.5. Drupal 10.6's core-dev requires ^9.6.34, and PHPUnit 11 needs PHP 8.2 while that job runs PHP 8.1. The constraint is now ^9.6 || ^11.5.
  • Debian 11 on the PHP 8.1 image: the previous-major job runs on Debian 11, and its security packages for glibc and dpkg now return 404 on the Debian mirrors, even though the index still lists them. On bullseye only, the job points apt's security source at the 2026-09-01 snapshot on snapshot.debian.org, which still has them, and turns off apt's expiry check for it. The other option would be to run that job on PHP 8.3, but then CI wouldn't test the php: 8.1 floor.
  • Flaky test: MongoDbTest::testCountCollection() used mt_rand(0, 100) for the document count, and insertMany() throws on an empty array. It failed once in the previous-minor job. The count now starts at 1.

CI status

Pipeline 980809, on the latest commit, passes:

  • Current core: composer, composer-lint, cspell, eslint, phpcs, PHPStan, stylelint and phpunit.
  • Previous major (Drupal 10.6, PHP 8.1): composer, PHPStan and phpunit.
  • Previous minor (Drupal 11.3, PHP 8.3): composer and phpunit.

The next-major (Drupal 12) composer, PHPStan and phpunit jobs fail, which is allowed, so the pipeline shows "passed with warnings".

Setting back to Needs review.

fgm’s picture

Status: Needs review » Reviewed & tested by the community

Mostly good, I added a few floor raises.

fgm’s picture

Status: Reviewed & tested by the community » Fixed

Merged in the latest 8.x-2.x-dev.

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.