Drupal 11 compatibility for Features module

Created on 15 May 2024, over 1 year ago

Problem/Motivation

Drupal 11.0.0 will be released later this year. Let's make the Features module Drupal 11 compatible. I've performed a static code analysis of work involved for Drupal 11 compatibility. In addition, the GitLab CI should probably add NEXT MAJOR to start running tests against Drupal 11. Additionally, it was proposed to drop support for older versions of Drupal in ๐Ÿ“Œ Drop Drupal 9 support Active , so I've included that consideration, below.

Auditor checklist

  • [ ] Deprecated Drupal code is remediated
  • [ ] Deprecated PHP code is remediated
  • [ ] Custom code is compatible with jQuery 4
  • [ ] Custom code coreversionrequirement indicates Drupal 11 compatibility

References

Composer

  • [ ] This module has a composer.json file. Manually review it for Drupal 11 compatibility, such as external requirements, core version constraints, and PHP version constraints

PHPStan Audit of Drupal deprecations

 [OK] No errors                                                                                                         

Drupal-Rector Audit of Drupal deprecations

 [OK] Rector is done!                                                                                                   

Audit of deprecated PHP <8.3 calls

If no errors are listed below, php-compatibility did not find any.

............................................................ 60 / 69 (87%)
.........                                                    69 / 69 (100%)


Time: 817ms; Memory: 18MB

jQuery 4 compatibility: List of all custom JavaScript files

Any files listed below should be reviewed for jQuery 4 compatibility

web/modules/contrib/features/modules/features_ui/js/features_ui.admin.js

Diff for updating coreversionrequirement

diff --git a/features.info.yml b/features.info.yml
index f2ded86..ddef07f 100644
--- a/features.info.yml
+++ b/features.info.yml
@@ -2,7 +2,7 @@ name: 'Features'
 type: module
 description: 'Enables administrators to package configuration into modules.'
 package: Development
-core_version_requirement: ^9.4 || ^10
+core_version_requirement: ^10 || ^11
 dependencies:
   - drupal:config
   - config_update:config_update
diff --git a/modules/features_ui/features_ui.info.yml b/modules/features_ui/features_ui.info.yml
index c5b9406..95d5872 100644
--- a/modules/features_ui/features_ui.info.yml
+++ b/modules/features_ui/features_ui.info.yml
@@ -2,7 +2,7 @@ name: Features UI
 type: module
 description: 'Provides the user interface for Features.'
 package: Development
-core_version_requirement: ^9.4 || ^10
+core_version_requirement: ^10 || ^11
 configure: features.assignment
 dependencies:
   - features:features
๐Ÿ“Œ Task
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States mark_fullmer Tucson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mark_fullmer
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Rajan Kumar@2026

    Hii @mark_fullmer

    I have created patch for "Drupal 11 compatibility for Features module" . Thanks

  • Status changed to RTBC 12 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cosmicdreams Minneapolis/St. Paul

    Came across this patch because I wanted to work features into a demo. I can't even get the demo going because I can't get features included via composer.

    We need this in.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cosmicdreams Minneapolis/St. Paul
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cosmicdreams Minneapolis/St. Paul

    I think this patch needs more testing. I did the following:

    1. I rolled a brand new D11 site with just features (and the require dependency, config_update and features_ui, installed).
    2. I navigated to the features_ui admin page (/admin/config/development/features) and received the following error:
    The website encountered an unexpected error. Try again later.
    
    Error: Call to a member function getName() on null in Drupal\features_ui\Form\FeaturesExportForm->buildPackageDetail() (line 382 of modules/contrib/features/modules/features_ui/src/Form/FeaturesExportForm.php).
    Drupal\features_ui\Form\FeaturesExportForm->buildListing() (Line: 181)
    Drupal\features_ui\Form\FeaturesExportForm->buildForm()
    call_user_func_array() (Line: 528)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
  • First commit to issue fork.
  • ๐Ÿ‡ญ๐Ÿ‡ฐHong Kong hswong3i

    Apply this MR for D11 now with:

    ...
        "repositories": {
            "https://packages.drupal.org/8": {
                "canonical": false,
                "type": "composer",
                "url": "https://packages.drupal.org/8"
            },
            "https://drupal.org/node/3447460": {
                "canonical": false,
                "type": "vcs",
                "url": "https://git.drupalcode.org/issue/features-3447460.git"
            },
        },
    ...
        "require": {
            "drupal/features": "dev-3447460-drupal-11-compatibility",
        }
    ...
    
  • Pipeline finished with Failed
    12 months ago
    Total: 164s
    #270294
  • Pipeline finished with Failed
    12 months ago
    Total: 161s
    #270295
  • Pipeline finished with Failed
    12 months ago
    Total: 299s
    #270859
  • Pipeline finished with Failed
    12 months ago
    Total: 450s
    #270862
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bradallenfisher

    so should we just manually install this for D11?

  • Pipeline finished with Success
    9 months ago
    #347114
  • Pipeline finished with Success
    9 months ago
    Total: 181s
    #347135
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mark_fullmer Tucson

    The latest two commits address compatibility with PHPUnit 10 and PHP 8.2:

    PHPUnit tests are green for both Drupal 10 and Drupal 11. This is ready for a narrowly-scoped release, 8.x-3.16, which would include only this change and https://git.drupalcode.org/project/features/-/commit/d8bb8c1baa795b93b27... compared to 8.x-3.15.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mark_fullmer Tucson

    Can the maintainers provide a timeline for when this compatibility will be provided in a new release? Thanks for all the work you do!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States timb

    looking forward to D11 release.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States trackleft2 Tucson, AZ ๐Ÿ‡บ๐Ÿ‡ธ

    Can we at least have a dev release with this change? Thanks for all the work you do!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States clayfreeman Paragould, AR

    Sending to Needs work on a small nit.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States trackleft2 Tucson, AZ ๐Ÿ‡บ๐Ÿ‡ธ

    That nitpick should be resolved in ๐Ÿ“Œ Use dependency injection instead \Drupal calls. Needs review

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States dave reid Nebraska USA

    dave reid โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States dave reid Nebraska USA
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States quicksketch

    Thank you so much @davereid! I tested this merge request against an active project and it worked great. In my testing, I was upgrading from Drupal 10.4.1 to 11.1.5.

    I tested by the following:

    Added a custom repository to the root composer.json in the "repositories" section:

            {
                "type": "vcs",
                "url":  "https://git.drupalcode.org/issue/features-3447460.git"
            }
    

    Changed my "require" line for Features to the branch:

            ...
            "drupal/core": "^11.1.5",
            "drupal/core-composer-scaffold": "^11.1.5",
            "drupal/core-project-message": "^11.1.5",
            "drupal/core-recommended": "^11.1.5",
            ...
            "drupal/features": "dev-3447460-drupal-11-compatibility",
            ...
    

    Then deleted composer.lock and ran composer install.

    As all my other dependencies were already upgraded on Drupal 11-compatible versions, I was then able to install Drupal 11 normally. Note that my site had several Feature modules that needed to be manually changed in their .info.yml files to core_version_requirement: '^9.3 || ^10 || ^11'.

    Drupal 11 installed successfully, using the new Features version.

    Once up and running I tested:

    • Viewing the list of all features.
    • Selecting a custom feature bundle for my installation profile.
    • Comparing features against active config.
    • Importing feature config into active.
    • Exporting/writing current config into feature modules via the bulk feature export.
    • Exporting/writing current config into a single feature via the feature configuration form
    • When exporting/writing a feature module, the .info.yml file was correctly changed to core_version_requirement: '^10 || ^11', including 11 and dropping 9.3.

    I still see some existing issues that pre-existed like #2912545: Permissions stripped from roles, but dependencies added anyway โ†’ , but I found no regressions and most importantly, this unblocks our project's upgrade to Drupal 11.

    Code changes all look great to me too. This looks ready to go!

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine podarok Ukraine

    +1 RTBC https://www.drupal.org/project/features/issues/3447460#comment-16051589 ๐Ÿ“Œ Drupal 11 compatibility for Features module Active #19
    Let's release major alpha|beta version of the module, please

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mark_fullmer Tucson

    Let's release major alpha|beta version of the module, please

    Agreed that a release is well justified, though I'll note that it should probably simply reflect a minor version release from 8.x-3.14 to 8.x-3.15 . Per https://www.drupal.org/project/drupal/issues/3357742 ๐ŸŒฑ Guidelines for semantic versioning and Drupal core support Active , this can be provided via a minor release since it does not drop support for currently supported versions of Drupal core.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States daddison

    Hi maintainers, thanks for all you do to make this valuable module available for the community! When can we expect a Drupal 11 release?

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil murilohp

    This is a static patch of the MR to be applied.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia brahmjeet789

    HI Maintainers, when we can expect Drupal 11 Release?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mark_fullmer Tucson

    Reviewing the commentary on the merge request, it appears that the only question holding this up is whether and how this module should leverage the new parameter, $previous_config_names, available in ConfigInstaller::findPreExistingConfiguration, per https://git.drupalcode.org/project/features/-/merge_requests/39#note_494953

    This new parameter was introduced in Drupal core (11.2.x) as part of ๐Ÿ“Œ Add the ability to install multiple modules and only do a single container rebuild to ModuleInstaller Active . Per that issue summary, the role of this parameter is a way of identifying when a container rebuild can be bypassed during the installation of a new module:

    A $previously_checked_config argument is added to the protected methods \Drupal\Core\Config\ConfigInstaller::findPreExistingConfiguration() and \Drupal\Core\Config\ConfigInstaller::findDefaultConfigWithUnmetDependencies(). This argument is a list of previously checked configuration, keyed by collection name.

    As this relates to the role of the Features module, as a tool for executing configuration imports on behalf of bundled configuration, I don't see this module as having a role in determining whether certain configuration changes can skip the container rebuild. That would be relevant only in the context of a finite, curated set of configuration in, say, a module, where the developer knows that a container rebuild is not necessary.

    Furthermore, this has been implemented in Drupal core's business logic as an addition to a conditional that checks for $active_storage->exists($config_name), so in the context of Features imports, the core code already checks what it needs to check: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...

    Therefore, I conclude that the Features implementation of should simply pass along the second parameter as is already staged in the merge request, array $previous_config_names = [].

    Thus this issue remains, in my opinion, RTBC. A timely merge and release for Drupal 11 compatibility is important to the community!

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rahul_ Alirajpur

    Hello Team,
    I would need to update my drupal site to D10 to D11, when we will plan this D11 supported version?
    Is there any tentative date?
    when we can expect Drupal 11 Supported Release?

Production build 0.71.5 2024