Automated Drupal 10 compatibility fixes

Created on 18 July 2022, over 2 years ago
Updated 29 November 2023, about 1 year ago

Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects โ†’

Periodically patches will be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted simply close this issue (any status besides Active, Needs review or Needs work) or remove the "ProjectUpdateBotD10" tag from the issue.

The patches will be posted by the Project Update Bot โ†’ official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review or Needs work) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but don't want new automated patches simply leave this issue open but remove the "ProjectUpdateBotD10" tag from the issue.

    You can use Drupal Rector yourself to make these patches.

    If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review or Needs work) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it may be useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the patch in the comment by Project Update Bot โ†’ .
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot โ†’ , such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue โ†’ . For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Infrastructure project issue queue โ†’ using the component โ€œBot: Drupal Rectorโ€.

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom jonnyhocks

    I've created a fork and applied the generated patch in #2

  • Status changed to RTBC almost 2 years ago
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands mike.vindicate

    The patch provided by the update bot is enough to make the module compatible with D10.

  • In my testing, the patch does not allow for me to upgrade from Drupal 9.5.9 to Drupal 10.0.9 with Views Contextual Range Filter (1.0.0) installed. Here are the steps I just tried on a local environment running PHP 8.1:

    1. Create a fresh Drupal 9.5.9 project: composer create-project drupal/recommended-project:9.5.9
    2. Require drupal/contextual_range_filter
    3. Require cweagans/composer-patches and enable patching.
    4. Apply the patch.
    5. Follow instructions to upgrade to Drupal 10 with Composer.

    If I remove drupal/contextual_range_filter from composer.json and then re-run composer update -W, Drupal 10 installs successfully.

    composer.json

    {
        "name": "drupal/recommended-project",
        "description": "Project template for Drupal 9 projects with a relocated document root",
        "type": "project",
        "license": "GPL-2.0-or-later",
        "homepage": "https://www.drupal.org/project/drupal",
        "support": {
            "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
            "chat": "https://www.drupal.org/node/314178"
        },
        "repositories": [
            {
                "type": "composer",
                "url": "https://packages.drupal.org/8"
            }
        ],
        "require": {
            "composer/installers": "^1.9",
            "cweagans/composer-patches": "~1.0",
            "drupal/contextual_range_filter": "^1.0",
            "drupal/core-composer-scaffold": "^10",
            "drupal/core-project-message": "^10",
            "drupal/core-recommended": "^10"
        },
        "conflict": {
            "drupal/drupal": "*"
        },
        "minimum-stability": "stable",
        "prefer-stable": true,
        "config": {
            "allow-plugins": {
                "composer/installers": true,
                "drupal/core-composer-scaffold": true,
                "drupal/core-project-message": true,
                "dealerdirect/phpcodesniffer-composer-installer": true
            },
            "sort-packages": true
        },
        "extra": {
            "enable-patching": true,
            "drupal-scaffold": {
                "locations": {
                    "web-root": "web/"
                }
            },
            "installer-paths": {
                "web/core": [
                    "type:drupal-core"
                ],
                "web/libraries/{$name}": [
                    "type:drupal-library"
                ],
                "web/modules/contrib/{$name}": [
                    "type:drupal-module"
                ],
                "web/profiles/contrib/{$name}": [
                    "type:drupal-profile"
                ],
                "web/themes/contrib/{$name}": [
                    "type:drupal-theme"
                ],
                "drush/Commands/contrib/{$name}": [
                    "type:drupal-drush"
                ],
                "web/modules/custom/{$name}": [
                    "type:drupal-custom-module"
                ],
                "web/profiles/custom/{$name}": [
                    "type:drupal-custom-profile"
                ],
                "web/themes/custom/{$name}": [
                    "type:drupal-custom-theme"
                ]
            },
            "drupal-core-project-message": {
                "include-keys": [
                    "homepage",
                    "support"
                ],
                "post-create-project-cmd-message": [
                    "<bg=blue;fg=white>                                                         </>",
                    "<bg=blue;fg=white>  Congratulations, youโ€™ve installed the Drupal codebase  </>",
                    "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                    "<bg=blue;fg=white>                                                         </>",
                    "",
                    "<bg=yellow;fg=black>Next steps</>:",
                    "  * Install the site: https://www.drupal.org/docs/installing-drupal",
                    "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                    "  * Get support: https://www.drupal.org/support",
                    "  * Get involved with the Drupal community:",
                    "      https://www.drupal.org/getting-involved",
                    "  * Remove the plugin that prints this message:",
                    "      composer remove drupal/core-project-message"
                ]
            },
            "patches": {
                "drupal/contextual_range_filter": {
                    "Rectorizes Drupal 10 compatibility": "https://www.drupal.org/files/issues/2022-07-18/contextual_range_filter.1.x-dev.rector.patch"
                }
            }
        }
    }
    

    Output from failed update

    โฏ composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' 'drupal/core-project-message:^10' --update-with-dependencies --no-update
    Info from https://repo.packagist.org: #StandWithUkraine
    ./composer.json has been updated
    
    Desktop/test/drupal9 via ๐Ÿ˜ v8.1.19
    โฏ composer update -W
    Gathering patches for root package.
    Loading composer repositories with package information
    Info from https://repo.packagist.org: #StandWithUkraine
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - zendframework/zend-feed 2.12.0 requires php ^5.6 || ^7.0 -> your php version (8.1.19) does not satisfy that requirement.
        - laminas/laminas-feed[2.12.0, ..., 2.12.3] require php ^5.6 || ^7.0 -> your php version (8.1.19) does not satisfy that requirement.
        - symfony-cmf/routing[1.4.0, ..., 1.4.1] require php ^5.3.9|^7.0 -> your php version (8.1.19) does not satisfy that requirement.
        - laminas/laminas-feed[2.13.0, ..., 2.14.1] require php ^7.3 || ~8.0.0 -> your php version (8.1.19) does not satisfy that requirement.
        - drupal/core[8.9.11, ..., 8.9.20] require php ^7.0.8 -> your php version (8.1.19) does not satisfy that requirement.
        - drupal/core[9.0.10, ..., 9.0.14] require php ^7.3 -> your php version (8.1.19) does not satisfy that requirement.
        - Root composer.json requires drupal/contextual_range_filter ^1.0 -> satisfiable by drupal/contextual_range_filter[1.0.0].
        - Conclusion: don't install drupal/core 9.5.2 (conflict analysis result)
        - drupal/core-recommended 10.0.2 requires drupal/core 10.0.2 -> satisfiable by drupal/core[10.0.2].
        - Conclusion: don't install drupal/core 10.0.2 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.3 (conflict analysis result)
        - drupal/core-recommended 10.0.3 requires drupal/core 10.0.3 -> satisfiable by drupal/core[10.0.3].
        - Conclusion: don't install drupal/core 10.0.3 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.4 (conflict analysis result)
        - drupal/core-recommended 10.0.4 requires drupal/core 10.0.4 -> satisfiable by drupal/core[10.0.4].
        - Conclusion: don't install drupal/core 10.0.4 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.5 (conflict analysis result)
        - drupal/core-recommended 10.0.5 requires drupal/core 10.0.5 -> satisfiable by drupal/core[10.0.5].
        - Conclusion: don't install drupal/core 10.0.5 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.6 (conflict analysis result)
        - drupal/core-recommended 10.0.6 requires drupal/core 10.0.6 -> satisfiable by drupal/core[10.0.6].
        - Conclusion: don't install drupal/core 10.0.6 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.7 (conflict analysis result)
        - drupal/core-recommended 10.0.7 requires drupal/core 10.0.7 -> satisfiable by drupal/core[10.0.7].
        - Conclusion: don't install drupal/core 10.0.7 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.8 (conflict analysis result)
        - drupal/core-recommended 10.0.8 requires drupal/core 10.0.8 -> satisfiable by drupal/core[10.0.8].
        - Conclusion: don't install drupal/core 10.0.8 (conflict analysis result)
        - Conclusion: don't install drupal/core 9.5.9 (conflict analysis result)
        - drupal/core-recommended 10.0.9 requires drupal/core 10.0.9 -> satisfiable by drupal/core[10.0.9].
        - Conclusion: don't install drupal/core 10.0.9 (conflict analysis result)
        - drupal/core[8.4.0, ..., 8.9.10] require symfony-cmf/routing ^1.4 -> satisfiable by symfony-cmf/routing[1.4.0, 1.4.1].
        - drupal/core[8.2.0, ..., 8.3.9] require symfony-cmf/routing ~1.4 -> satisfiable by symfony-cmf/routing[1.4.0, 1.4.1].
        - drupal/core[8.8.0, ..., 8.8.12] require zendframework/zend-feed ^2.12 -> satisfiable by laminas/laminas-feed[2.12.0, ..., 2.14.1], zendframework/zend-feed[2.12.0].
        - drupal/core-recommended 10.0.1 requires drupal/core 10.0.1 -> satisfiable by drupal/core[10.0.1].
        - Conclusion: don't install drupal/core 10.0.1 (conflict analysis result)
        - drupal/contextual_range_filter 1.0.0 requires drupal/core ^8 || ^9 -> satisfiable by drupal/core[8.0.0, ..., 8.9.20, 9.0.0, ..., 9.5.9].
        - You can only install one version of a package, so only one of these can be installed: drupal/core[8.0.0, ..., 8.9.20, 9.0.0, ..., 9.5.9, 10.0.0, ..., 10.0.9].
        - You can only install one version of a package, so only one of these can be installed: drupal/core[8.1.2, ..., 8.9.20, 9.0.0, ..., 9.5.9, 10.0.0, ..., 10.0.9].
        - You can only install one version of a package, so only one of these can be installed: drupal/core[8.1.8, ..., 8.9.20, 9.0.0, ..., 9.5.9, 10.0.0, ..., 10.0.9].
        - You can only install one version of a package, so only one of these can be installed: drupal/core[8.7.0, ..., 8.9.20, 9.0.0, ..., 9.5.9, 10.0.0, ..., 10.0.9].
        - drupal/core-recommended 10.0.0 requires drupal/core 10.0.0 -> satisfiable by drupal/core[10.0.0].
        - Root composer.json requires drupal/core-recommended ^10 -> satisfiable by drupal/core-recommended[10.0.0, ..., 10.0.9].
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
    
  • ๐Ÿ‡ท๐Ÿ‡ดRomania abautu

    The reason why the module doesn't install even when you apply the patch is that the patch is applied to the module code only if instalation is succesfull (so that Drupal 10 can install the module). However, before instalation, composer checks the module metadata (from https://packages.drupal.org/files/packages/8/p2/drupal/contextual_range_... and finds out the module requires drupal/core:^8 || ^9) and refuses the instalation.

    Therefore, you need the patch for Drupal, but you also need this for composer: define a package repository in your composer.json and tell composer this package works with drupal/core:^10. Add this lines inside repositories, above your the https://packages.drupal.org/8 repository.

            {
              "type": "package",
              "package": {
                "version": "1.0.0",
                "dist": {
                  "type": "zip",
                  "url": "https:\/\/ftp.drupal.org\/files\/projects\/contextual_range_filter-8.x-1.0.zip",
                  "reference": "8.x-1.0",
                  "shasum": "0e7d74a9b6762b2aec881ae0580433884661972f"
                },
                "type": "drupal-module",
                "name": "drupal\/contextual_range_filter",
                "require": {
                  "drupal\/core": "^8 || ^9 || ^10"
                }
              }
            },
    
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany vistree

    Can we have a D10 compatible release in the meanwhile?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada chrisck BC, Canada

    +1 to new D10 release please

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States seth.e.shaw

    +1 to a new D10 release. D9's EOL is quickly approaching.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Shane Birley

    +1 Drupal 10 upgrades are starting in my world.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia JayVisaria

    Could you please release a D10-compatible version?

Production build 0.71.5 2024