Automated Drupal 10 compatibility fixes

Created on 16 June 2022, almost 3 years ago
Updated 21 March 2024, 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

Fixed

Version

2.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.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly kopeboy Milan

    Up

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡น๐Ÿ‡ทTurkey orkut murat yฤฑlmaz Istanbul

    Hello all,

    Thank you @voleger for your contribution.

    I've downloaded the @voleger's commit on 'merge request !7' as a patch and tried to apply, but unfortunately it has failed with the error log below:

    $ patch -p1 < 7.patch
    patching file oauth2_server.api.php
    patching file oauth2_server.info.yml
    patching file oauth2_server.services.yml
    patching file src/Authentication/Provider/OAuth2DrupalAuthProvider.php
    patching file src/Form/AuthorizeForm.php
    patching file src/OAuth2Storage.php
    patching file src/ScopeUtility.php
    patching file src/Utility.php
    patching file tests/src/Functional/OAuth2ServerAdminTest.php
    patching file tests/src/Functional/OAuth2ServerStorageTest.php
    patching file tests/src/Functional/OAuth2ServerTest.php
    patching file src/OAuth2Helper.php
    Hunk #1 FAILED at 37.
    Hunk #2 FAILED at 45.
    2 out of 2 hunks FAILED -- saving rejects to file src/OAuth2Helper.php.rej

    What could be the reason of fails?

    Best,
    Orkut

  • Status changed to Needs review almost 2 years ago
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update almost 2 years ago
    Waiting for branch to pass
  • This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

    It is important that any automated tests available are run with this patch and that you manually test this patch.

    Drupal 10 Compatibility

    According to the Upgrade Status module โ†’ , even with this patch, this module is not yet compatible with Drupal 10.

    Currently Drupal Rector, version 0.15.1, cannot fix all Drupal 10 compatibility problems.

    Therefore this patch does not update the info.yml file for Drupal 10 compatibility.

    Leaving this issue open, even after committing the current patch, will allow the Project Update Bot โ†’ to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

    Debug info

    Bot run #12554

    This patch was created using these packages:

    1. mglaman/phpstan-drupal: 1.1.35
    2. palantirnet/drupal-rector: 0.15.1
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡น๐Ÿ‡ทTurkey orkut murat yฤฑlmaz Istanbul

    I've applied the patch #11 and received the logs I paste below:

    $ patch -p1 < oauth2_server.2.0.x-dev.rector.patch 
    patching file oauth2_server.api.php
    Hunk #2 FAILED at 28.
    Hunk #3 FAILED at 49.
    2 out of 3 hunks FAILED -- saving rejects to file oauth2_server.api.php.rej
    patching file src/Authentication/Provider/OAuth2DrupalAuthProvider.php
    Hunk #1 succeeded at 2 with fuzz 1.
    Hunk #2 succeeded at 215 (offset 32 lines).
    patching file src/Form/AuthorizeForm.php
    Hunk #1 FAILED at 118.
    1 out of 1 hunk FAILED -- saving rejects to file src/Form/AuthorizeForm.php.rej
    patching file src/OAuth2Storage.php
    Hunk #1 succeeded at 1011 (offset -11 lines).
    patching file src/Utility.php
    patching file tests/src/Functional/OAuth2ServerAdminTest.php
    Hunk #4 succeeded at 60 (offset 1 line).
    Hunk #5 succeeded at 72 with fuzz 2 (offset 1 line).
    Hunk #6 succeeded at 106 (offset 10 lines).
    patching file tests/src/Functional/OAuth2ServerStorageTest.php
    patching file tests/src/Functional/OAuth2ServerTest.php

    After that, I've checked the upgrade status page and it looks uncompatible, locally.

    I'm changing the issue status as Needs Work.

    Best,
    Orkut

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia cafuego

    The patch from #11 seems to apply just fine to the 2.0.x branch. Whether it makes the module work with D10 is another issue :-)

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada porchlight

    After applying the changes in the current merge request I'm getting an error when I run cron. Need to add `$query->accessCheck(TRUE);` to the hook_cron function in the .module. I would do it but I don't know how to add to the MR.

  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dernetzjaeger Rostock

    I scanned the latest dev version plus the patch from #11 applied with the upgrade status module and found 6 D10 incompatibility issues.

    I fixed these issues in my patch and rescanned it with no further open issues.

    I also tested this version in my test installation with a Drupal instance running oauth2_server Module and another Drupal instance running openid_connect Module.

    The whole process worked properly and I was able to log in,

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 fail
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany dernetzjaeger Rostock

    After running the Upgrade from D9 to D10 I ran into the following message when running drush updb:

     Unable to decode output into JSON: Syntax error
    
      Fatal error: Declaration of Drupal\oauth2_server\OAuth2Storage::setAuthorizationCode($code, $client_id, $uid, $redirect_uri, $expires, $scope = null, $id_token = null) must be compatible with OAuth2\OpenID\Storage\AuthorizationCodeInterface::setAuthor
      izationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null, $id_token = null, $code_challenge = null, $code_challenge_method = null) in /app/web/modules/contrib/oauth2_server/src/OAuth2Storage.php on line 536
    

    The new patch resolves this issue.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    Composer require failure
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & pgsql-14.1
    last update over 1 year ago
    Composer require failure
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahal_va

    Hi @dernetzjaeger

    This might help https://www.drupal.org/project/oauth2_server/issues/3366668 ๐Ÿ› module stopped working after library upgrade RTBC

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hyperlinked San Jose, CA

    Patch #16 isn't completely working for me on 10.1.5. When I clear the cache I get the following error:

    Interface "OAuth2\OpenID\Storage\AuthorizationCodeInterface" not found

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hyperlinked San Jose, CA

    Nevermind, #16 works. I didn't have the two required vendor packages installed. After requiring bshaffer/oauth2-server-php and bshaffer/oauth2-server-httpfoundation-bridge, #16 is working. I haven't been able to confirm that I'm able to login yet as I'm having some other unrelated issues with the login process.

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hyperlinked San Jose, CA

    I've resolved the unrelated issues that were blocking me from successfully completing a remote site authorization and I can now confirm that patch #16 is working for me and resolves all of my issues. I'm using the authorization code grant with refresh tokens.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine v.koval

    Hi, community!
    The patch in #16 does not work for users using version 2.0.0-beta4. 2.0.0-beta4 This is the tag, and the patch is applied to the development branch

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8 (--ignore-platfrom-reqs)
    last update over 1 year ago
    Composer require failure
  • ๐Ÿ‡น๐Ÿ‡ทTurkey orkut murat yฤฑlmaz Istanbul

    @v.koval, the patch #16 is for the version 2.0.x-dev, as seen on issue metadata. After merge and deployment process is done, it will be working for other versions as well.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine v.koval

    ok, thanks!

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia cafuego

    I have a set of patches that works for 2.0.0-beta4 (which I use because part of the refactor of 2.0.x-dev has broken a thing I need) with Drupal 10 and PHP 8.2:

  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine v.koval

    @cafuego Thanks!
    But, this patch doesn't work, because in the module are a lot of deprecation functions. I created a new patch, it works for me

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.2 & pgsql-14.1
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.2 & pgsql-14.1
    last update over 1 year ago
    Composer require failure
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands robertragas

    Hello Koval,

    For me also your patch does not work on Drupal 10 with 2.0.0-beta4 due to the setAuthorizationCode compatibility that #16 refers to.
    Attached the patch based on #25 but with the setAuthorizationCode compatibility from #16.

    Would be good though if we can get that dev version with #16 released to a new version to avoid divergent patches like we have now.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia cafuego

    @v.koval For the record, my patch only works on the beta if you also apply the other patches I listed in the comment.

  • patch #26 doesnt work.

    + foreach (\Drupal::moduleHandler()->invokeAllWith('oauth2_server_default_scope') as $module)

    This code introduce an error

    Too few arguments to function Drupal\Core\Extension\ModuleHandler::invokeAllWith(),

    because this method expected 2 arguments.

  • First commit to issue fork.
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Canceled
    over 1 year ago
    Total: 34s
    #66026
  • Pipeline finished with Failed
    over 1 year ago
    Total: 251s
    #66027
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    over 1 year ago
    Total: 319s
    #66049
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    over 1 year ago
    Total: 170s
    #66058
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    over 1 year ago
    Total: 231s
    #66063
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    over 1 year ago
    Total: 183s
    #66069
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    over 1 year ago
    Total: 316s
    #66081
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Pipeline finished with Success
    over 1 year ago
    #66084
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom somersoft

    Please review again.

    As the oauth2_server.info.yml file needs updating so that it runs with Drupal 10 Framework a fork was made of the code base and updated to be Drupal 10 compatible.
    The #26 patch has been added to this code base and also a fix for #28 comment.
    The default CI pipeline template has been added and all the tests pass.

    Example entry for composer.json

        "repositories": {
            "oauth2_server": {
                "type": "package",
                "package": {
                    "name": "drupal/oauth2_server",
                    "version": "dev-custom",
                    "type": "drupal-module",
                    "source": {
                        "url": "https://git.drupalcode.org/issue/oauth2_server-3288840",
                        "type": "git",
                        "reference": "8ed68d27336dcbea0041b0c5e25f92888c6e3ac1"
                    }
                }
            }
        }
       "require": {
            "drupal/oauth2_server": "dev-custom"
        }
    
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & pgsql-14.1
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.2 & pgsql-14.1
    last update about 1 year ago
    22 pass
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance GaรซlG Lille, France

    GaรซlG โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: php8.3_mysql8
    last update about 1 year ago
    22 pass
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: php8.3_mysql8
    last update about 1 year ago
    22 pass
  • Status changed to Fixed about 1 year ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia cafuego

    Thanks everyone, merge request is merged.

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

Production build 0.71.5 2024