Automated Drupal 10 compatibility fixes

Created on 18 July 2022, almost 2 years ago
Updated 21 June 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

Fixed

Version

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

  • 🇨🇴Colombia sergiogsanchez

    I made a patch with the fixes for the d10 compatibility issues reported by the rector module and added the d10 readiness and the Symfony ldap library update, which is hopefully useful for d10 portability.

  • 🇨🇴Colombia sergiogsanchez

    Adding a new patch without the ci php-ldap command.

  • Status changed to Needs work over 1 year ago
  • 🇨🇴Colombia sergiogsanchez

    Adding a patch with adjustments regarding to the new external auth version.

  • Status changed to Needs review over 1 year ago
  • 🇪🇸Spain ecdani

    The updated dependency to "externalauth" isn't taken into account when "composer" resolves the dependencies, the patching is done after that.
    So, although the module has been patched, it is preventing from update "externalauth".

  • The patch in #3297516-7: Automated Drupal 10 compatibility fixes replaces the grahl/ldap dependency. There is a separate issue for that: Switch grahl/ldap to symfony/ldap Closed: duplicate .

  • First commit to issue fork.
  • First commit to issue fork.
  • @solideogloria opened merge request.
  • I added a space after type casting in the merge request.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
    +++ b/composer.json
    @@ -5,9 +5,12 @@
    +        "symfony/ldap": "^5.4",
    

    Shouldn't this be 5 or 6? We use symfony 6 in Drupal 10

    Will commit it as is so we can get a test run, but we'll likely need a follow up

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
  • Status changed to Fixed over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    I've committed #7

    Queueing some tests now

  • Status changed to Postponed over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Ok, looks like we're now blocked on https://www.drupal.org/project/authorization

  • @larowlan So Switch grahl/ldap to symfony/ldap Closed: duplicate is outdated now, right?

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Yeah, that one can be closed as a duplicate of this I think

  • I think maybe this is the only issue needed for Authorization?

    📌 Drupal 10 patch (rector) Fixed

  • FYI, there are no active maintainers for Authorization, AFAIK. The commit log shows that grahl made all the recent commits there, and nothing has been committed since September 2021. So if you want to volunteer as a maintainer there, the RTBC patches could get committed.

  • Can we have a new release that contains this commit? It's not possible to patch this with Composer, because the composer.json file will be patched after the old dependencies (grahl/ldap) have already been installed.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    @sergiogsanchez are you interested in following the same process as you did to become an LDAP maintainer for the authorization module? e.g. open a support issue, send a link to the issue via contact forms etc. If there's no reply, then you can move to the process after two weeks.

  • 🇮🇳India raveendrab

    Hi,

    I am trying to install the dev version on a clean drupal 10 using composer.
    I am able to install authorization dev version as the drupal 10 patch has been applied. However, while installing ldap dev module using compser, i am getting the following errors.
    - drupal/ldap 4.x-dev is an alias of drupal/ldap dev-4.x and thus requires it to be installed too.
    - drupal/ldap dev-4.x requires drupal/ldap_servers * -> satisfiable by drupal/ldap_servers[4.0.0, 4.1.0, 4.2.0, 4.3.0].
    - Root composer.json requires drupal/ldap 4.x-dev@dev -> satisfiable by drupal/ldap[4.x-dev (alias of dev-4.x)].

  • Status changed to Needs review about 1 year ago
  • Setting to Needs Review, as the Drupal 10 fixes were committed for Authorization. If someone can verify that everything works as it should, this can be set to Fixed.

    @raveendrab I set up a clean install, both for Drupal 9 and Drupal 10, and installing drupal/ldap:4.x-dev via composer works. You don't need to require authorization, as it's a dependency of ldap. If you want the dev version of authorization, you'll have to install the stable version, then add the later commits as patches to your composer file(s).

  • 🇸🇦Saudi Arabia ishore

    Hi!

    Core 9.5.7
    Authorization 8.x-1.0-beta6 plus 3327917-full-d10-upgrade.patch
    TFA 2.0.0-alpha2
    PHP 8.1
    PostgreSQL 13.7

    In preparation for migration to Drupal 10, I tried updating ldap module to latest dev version. The upgrade seemed to go well:

    drupal@dev1:/srv/www$ composer require 'drupal/ldap:4.x-dev@dev' --with-all-dependencies
    ./composer.json has been updated
    Running composer update drupal/ldap --with-all-dependencies
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 1 install, 2 updates, 1 removal
    - Removing grahl/ldap (v5.2.0.1)
    - Upgrading drupal/externalauth (1.4.0 => 2.0.3)
    - Upgrading drupal/ldap (4.3.0 => dev-4.x 9e018e7)
    - Locking symfony/ldap (v6.2.8)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 2 updates, 1 removal
    - Downloading drupal/externalauth (2.0.3)
    - Syncing drupal/ldap (dev-4.x 9e018e7) into cache
    - Downloading symfony/ldap (v6.2.8)
    - Removing grahl/ldap (v5.2.0.1)
    - Upgrading drupal/externalauth (1.4.0 => 2.0.3): Extracting archive
    - Removing drupal/ldap (4.3.0)
    - Installing symfony/ldap (v6.2.8): Extracting archive
    - Installing drupal/ldap (dev-4.x 9e018e7): Cloning 9e018e757d from cache
    Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
    Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
    Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
    Generating autoload files
    77 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    Endroid Installer did not detect a specific framework for auto-configuration
    No security vulnerability advisories found

    I cleared the cache after the update.

    Now, when I try to login as an LDAP user it fails, after entering the password, with the following message:

    The website encountered an unexpected error. Please try again later.
    Error: Class "Symfony\Component\Ldap\Ldap" not found in Drupal\ldap_servers\LdapBridge->setServer() (line 109 of modules/contrib/ldap/ldap_servers/src/LdapBridge.php).

    I can login okay as a local user, but still get the above message after entering the password. After re-entering the website URL, I do get the home page and see that I am logged in. The home page however does have another couple of error messages:

    Warning: include(/srv/www/vendor/composer/../grahl/ldap/Ldap.php): Failed to open stream: No such file or directory in include() (line 571 of /srv/www/vendor/composer/ClassLoader.php).

    Warning: include(): Failed opening '/srv/www/vendor/composer/../grahl/ldap/Ldap.php' for inclusion (include_path='/srv/www/vendor/pear/archive_tar:/srv/www/vendor/pear/console_getopt:/srv/www/vendor/pear/pear-core-minimal/src:/srv/www/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in include() (line 571 of /srv/www/vendor/composer/ClassLoader.php).

    I have not tried a clean install yet.

  • 🇸🇦Saudi Arabia ishore

    Update - clearing the cache a second time and/or restarting Apache appears to have fixed all issues.

  • 🇺🇦Ukraine deimos

    Hi,

    During project (site) preparation to the D10 I tried latest module's dev version, i.e. composer require 'drupal/ldap:4.x-dev@dev' --with-all-dependencies
    And I can confirm that the module basically works with D10 after upgrade from D9. (I haven't got a chance to test the module on actual site after upgrade to D10 yet.)
    Here is a short info about environment setup:

    • Core - 10.0.9
    • PHP - 8.1.20
    • MariaDB - 10.4.28-MariaDB-1:10.4.28+maria~ubu2004-log

    For LDAP server I used setup provided by LDAP module itself - Hogwarts

    Before upgrade from D9 to D10 I run upgrade-status analysis (drush upgrade_status:analyze ldap) and got the following report. So I added fixed based on it (see attached patch file).

    Also I run unit-tests after upgrade to D10 and got a couple of PHP errors like
    PHPUnit\Framework\Exception: PHP Fatal error: Declaration of Drupal\ldap_servers_dummy\FakeQuery::execute() must be compatible with Symfony\Component\Ldap\Adapter\QueryInterface::execute() So patch-file has corrections for that too.

    In general, patch-file provides:
    - Add ->accessCheck()
    - Fix PHP Fatal error in tests

    Patch file doesn't provide (I skipped that because don't feel confident to fix LDAP module's tests):
    - Fixes in tests when deprecated PHPUnit methods are used. For example, Call to deprecated method setMethods() of class PHPUnit\Framework\MockObject\MockBuilder

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    45 pass
  • 🇨🇴Colombia sergiogsanchez

    Thanks for the heads up @Deimos; I recently merged some fixes for the unit test, so I created a new one based on your patch.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    45 pass
  • Status changed to RTBC about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • 🇨🇴Colombia jidrone

    As explained in the change record related with the Access Check , only the content entities are affected by this change.

    Most of the code changes in previous patches are related to that change record, but applied to config entities like ldap_server, user_role, etc.

    So I think there is only one change related with Drupal 10 compatibility fixes, but it was already fixed on 🐛 Automated testing symfony/ldap 6.x issues Fixed

    +++ b/ldap_servers/tests/modules/ldap_servers_dummy/src/FakeQuery.php
    @@ -28,7 +29,7 @@ class FakeQuery implements QueryInterface {
    +  public function execute(): CollectionInterface {
    

    From my perspective all the things related to D10 compatibility are fixed, so I'm moving this to RTBC and other CS issues can be fixed in a separate issue.

  • Status changed to Fixed about 1 year ago
  • 🇨🇴Colombia sergiogsanchez

    Drupal 10 version was released

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

Production build 0.69.0 2024