Automated Drupal 10 compatibility fixes

Created on 16 June 2022, over 2 years ago
Updated 4 June 2023, over 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

Needs review

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.

  • First commit to issue fork.
  • 🇨🇦Canada TrevorBradley

    As best I can tell, my local testing suggests the patch in #4 works against 8.x-2.6 (so log as I change info.yml to permit Drupal 10), but when I attempted to create a fork against 8.x-2.x-dev, the patch fails to apply.

    I'm going to assume there have been changes since 2.6 for a reason. But one vote up for this automated patch still working in D10.

  • Status changed to Needs work over 1 year ago
  • 🇨🇦Canada TrevorBradley

    OK, an update.

    I've mostly gotten Patch #4 to work for D10, with modifications. There are flaws, one of them I can't fix without context.

    Again, patch #4 applies only against 8.x-2.6, not the current dev branch.

    Current fixes to get things mostly working:

    Apply patch #4 to 8.x-2.6

    Change private_taxonomy.info.yml to permit version ^10

    Modify line 115 of src/Plugin/Field/FieldWidget/PrivateTaxonomyAutocompleteWidget.php:
    '#autocomplete_route_name' => $this->getSetting('autocomplete_route_name'),
    (the old function was deprecated)

    I thought everything looked great, but then I pointed PHPStan against it. I found a few faults in src/Type/PrivateTaxonomyTermReferenceItem.php:

    It makes reference to several classes without referring to them in a use clause - I added them in manually:

    use Drupal\Core\Entity\EntityTypeInterface;
    use Drupal\Core\Entity\FieldableEntityInterface;
    use Drupal\Core\Entity\TypedData\EntityDataDefinition;
    use Drupal\Core\Field\FieldItemBase;
    use Drupal\Core\Field\FieldStorageDefinitionInterface;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\Core\TypedData\DataReferenceDefinition;
    use Drupal\Core\TypedData\DataReferenceTargetDefinition;

    Also, one bug I can't fix. propertyDefinitions() makes reference to $target_type_info twice, but doesn't define it.

    Anyways, TLDR, Patch #4 is pretty close, would be good to get it to apply against dev to get things moving forward.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    17 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 #12888

    This patch was created using these packages:

    1. mglaman/phpstan-drupal: 1.1.35
    2. palantirnet/drupal-rector: 0.15.1
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    17 pass
  • 🇮🇹Italy Giuseppe87

    Attached a updated patch starting from #9 and the reports of #8 and drupal-rector and drupal-phpstan

    • src/Plugin/Field/FieldWidget/PrivateTaxonomyAutocompleteWidget.php: Call to deprecated function taxonomy_implode_tags().
    • src/Type/PrivateTaxonomyTermReferenceItem.php : missing import of various classes, $target_type_info not defined

    Personally I haven't tried the patch yet, but at least from automatic tools reviews the module should be D10 ready.

  • 🇩🇪Germany pp.panatom

    pp.panatom made their first commit to this issue’s fork.

  • Status changed to RTBC 9 months ago
  • 🇮🇳India Bushra Shaikh

    I have reviewed and applied patch #10 this works for Drupal 9.5.11 and Drupal 10.0. and 10.0.1
    Screenshots of the compatibility on 9.5.11 have been attached for reference:

    can be moved to RTBC+1

  • Status changed to Needs review 9 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Patch Failed to Apply
  • 🇺🇸United States cmlara

    Sending back to Needs review as we can’t trust Specbee reports. There is nothing in comment #12 that indicates anything other than what DrupalCi would have already tested.

    Specbee (including this specific user) has been seen to not fully test issues and may just be attempting to gain credits for their D.O. partner rating.

    More importantly, this module is basically un-maintained at the moment. If someone is going to want to see issues closed out they are going to need to consider stepping up and working on the rest of the queue to show their interest in maintaining the code.

  • 🇺🇦Ukraine proweb.ua

    patch #10 and private_taxonomy 8.x-2.6:

    patching file private_taxonomy.info.yml
    patching file src/Plugin/Field/FieldWidget/PrivateTaxonomyAutocompleteWidget.php
    patching file src/Type/PrivateTaxonomyTermReferenceItem.php
    patching file tests/src/Functional/PrivateTaxonomyPermissionsTest.php
    Hunk #3 succeeded at 35 with fuzz 2.
    Hunk #4 succeeded at 41 (offset -8 lines).
    Hunk #5 succeeded at 109 (offset -12 lines).
    Hunk #6 succeeded at 199 (offset -8 lines).
    Hunk #7 succeeded at 265 (offset -8 lines).
    Hunk #8 FAILED at 306.
    1 out of 8 hunks FAILED -- saving rejects to file tests/src/Functional/PrivateTaxonomyPermissionsTest.php.rej
    patching file tests/src/Functional/PrivateTaxonomySettingsTest.php
    patching file tests/src/Functional/PrivateTaxonomyTestBase.php
    patching file tests/src/Functional/PrivateTaxonomyTokensTest.php
    patching file tests/src/Functional/PrivateTaxonomyUnitTest.php
    patching file tests/src/Functional/PrivateTaxonomyViewsTest.php

Production build 0.71.5 2024