Automated Drupal 10 compatibility fixes

Created on 15 June 2022, over 2 years ago
Updated 22 December 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

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

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, Needs work or Reviewed and tested by the community) 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.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  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 then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). 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, Needs work and Reviewed and tested by the community) 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 would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

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 Project analysis issue queue .

📌 Task
Status

RTBC

Version

2.0

Component

Code

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

Comments & Activities

Not all content is available!

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

  • 🇮🇳India prashant.c Dharamshala

    The patch is not applying on Drupal 10.1.x

    drupal-check shows a few minor issues:

    ------ --------------------------------------------------------------------------------------------------------------------------- 
      Line   src/EncryptionTrait.php (in context of class Drupal\encryption\EncryptionService)                                          
     ------ --------------------------------------------------------------------------------------------------------------------------- 
      43     Method Drupal\encryption\EncryptionService::encrypt() should return string|null but return statement is missing.           
      75     Method Drupal\encryption\EncryptionService::decrypt() should return string|null but return statement is missing.           
      101    Method Drupal\encryption\EncryptionService::getEncryptionKey() should return string|null but return statement is missing.  
     ------ --------------------------------------------------------------------------------------------------------------------------- 
    
     ------ -------------------------------------------------------------------------------------------------------------------------------------------- 
      Line   tests/src/Kernel/EncryptionServiceTest.php                                                                                                  
     ------ -------------------------------------------------------------------------------------------------------------------------------------------- 
      24     Return type mixed of method Drupal\Tests\encryption\Kernel\EncryptionServiceTest::setUp() is not covariant with return type void of method  
             PHPUnit\Framework\TestCase::setUp().                                                                                                        
     ------ -------------------------------------------------------------------------------------------------------------------------------------------- 

    But by just making the following changes

    core_version_requirement: ^8 || ^9 || ^10 will make this module compatible with Drupal 10, do not see any other major changes to make it D10 compatible.

    It would be greatly appreciated if the module maintainers could create a release for Drupal 10 of this module. It is widely used on many websites and will be advantageous during the upgrade process from Drupal 8 or 9 to 10.

    Thank you.

  • 🇯🇵Japan tyler36 Osaka

    Updated MR with latest recommendations from drupal/upgrade_status": "^4.0".

    MR installed on Drupal 10.0

  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India prashant.c Dharamshala

    Throws the following error:

    Deprecated function: base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\encryption\EncryptionService->getEncryptionKey() (line 98 of modules/contrib/encryption/src/EncryptionTrait.php).
    Drupal\encryption\EncryptionService->getEncryptionKey() (Line: 43)
    Drupal\encryption\EncryptionService->encrypt('simple test value') (Line: 54)
    encryption_requirements('runtime')
    call_user_func_array(Object, Array) (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'encryption') (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('requirements', Object) (Line: 416)
    Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 109)
    Drupal\system\SystemManager->listRequirements() (Line: 49)
    Drupal\system\Controller\SystemInfoController->status()
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 44)
    Drupal\redirect_after_login\RedirectMiddleware->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 686)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Please review.

  • Status changed to RTBC over 1 year ago
  • 🇳🇱Netherlands falco010 🇳🇱 The Netherlands

    Successfully tested the above MR/fork & the deprecation error, in my opinion this is RTBC.

  • 🇺🇸United States caspervoogt

    #11 worked for me and comes back green in Upgrade Status. I have not yet updated to 10 but RTBC from me

  • 🇮🇳India Parvateesam

    Hello @maintainers:

    Thanks for the patch, the patch provided for D10 compatibility is applied but while trying to upgrade Drupal core from 9.5.11 to 10.1.4 facing below problem. So is there any clue, to move forward. Also is there any update to be released D10 compatibility?

      Problem 1
        - Root composer.json requires drupal/encryption ^2.0 -> satisfiable by drupal/encryption[2.0.0].
        - drupal/encryption 2.0.0 requires drupal/core ^8 || ^9 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev, 9.0.0-alpha1, ..., 9.5.x-dev] but it conflicts with your root composer.json require (10.1.4).
    

    Thanks.

  • 🇨🇦Canada davemybes Montreal

    What appears to be happening with the patches is that even though the info.yml file is showing D10 compatibility, composer.lock is still registering it as D9 only, so composer won't actually do the upgrade. We need an actual release to be able to update to D10. The only alternative is to move the module into custom modules and not use composer to update it - at least until a proper release is out.

  • 🇨🇦Canada TrevorBradley

    @davemybes, there's a third option:

    You can add the git repo for a contrib module into the repositories section of your composer.json:

            {
                "type": "package",
                "package": {
                    "name": "drupal_git/encryption",
                    "version": "2.0.0",
                    "type": "drupal-module",
                    "source": {
                        "url": "https://git.drupalcode.org/project/encryption.git",
                        "type": "git",
                        "reference": "8.x-1.x"
                    }
                }
            },

    You can then composer require drupal_git/encryption, rather than drupal/encryption (in your require section), and then patch encryption in your extras => patches section, and it does work. This gets around the info.yml version requirement.

    Example of this here: https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-pa...

  • First commit to issue fork.
  • @alejomc opened merge request.
  • 🇬🇧United Kingdom ikit-claw

    Thanks everyone I have made a new branch for the new changes.
    Please try it and let me know if you have any issues.

    composer require 'drupal/encryption:^3.0'

  • 🇮🇳India prashant.c Dharamshala

    As we already have D10 version released and available for download and working fine, you may want to credit the people who made efforts to contribute and mark this issue as fixed.

Production build 0.71.5 2024