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.

Issue fork ldap-3297516

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new8.67 KB

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.13.0, cannot fix all Drupal 10 compatibility problems.

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 #139

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.24
  2. palantirnet/drupal-rector: 0.13.0
project update bot’s picture

sergiogsanchez’s picture

Issue summary: View changes
StatusFileSize
new15.21 KB

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.

sergiogsanchez’s picture

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

Status: Needs review » Needs work

The last submitted patch, 5: 3297516-drupal-10-compatibility-fixes-no-ci.patch, failed testing. View results

sergiogsanchez’s picture

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

sergiogsanchez’s picture

Status: Needs work » Needs review
ecdani’s picture

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.

lars.stiebenz’s picture

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

realityloop made their first commit to this issue’s fork.

solideogloria made their first commit to this issue’s fork.

solideogloria’s picture

I added a space after type casting in the merge request.

larowlan’s picture

+++ 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

larowlan’s picture

larowlan’s picture

Status: Needs review » Fixed

I've committed #7

Queueing some tests now

larowlan’s picture

Status: Fixed » Postponed

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

solideogloria’s picture

@larowlan So #3097854: Switch grahl/ldap to symfony/ldap is outdated now, right?

larowlan’s picture

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

solideogloria’s picture

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

#3327917: Drupal 10 patch (rector)

solideogloria’s picture

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.

solideogloria’s picture

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.

larowlan’s picture

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

raveendrab’s picture

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)].

solideogloria’s picture

Status: Postponed » Needs review

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

ishore’s picture

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.

ishore’s picture

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

solideogloria’s picture

Status: Needs review » Reviewed & tested by the community

Sounds good. I'm going to mark this as RTBC. However, it should not be marked "Fixed", as this is the Rector issue that receives automated patches.

It's possible the proper status is "Active", but I'm not sure. If that's better, someone can change it.

deimos’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new13.71 KB
new9.93 KB

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 - LDAP-upgrade-status-report.txt. 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

sergiogsanchez’s picture

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.

jidrone’s picture

Status: Needs review » Reviewed & tested by the community

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 #3358276: Automated testing symfony/ldap 6.x issues

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

sergiogsanchez’s picture

Status: Reviewed & tested by the community » Fixed

Drupal 10 version was released

Status: Fixed » Closed (fixed)

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