Automated Drupal 10 compatibility fixes

Created on 18 July 2022, almost 2 years ago
Updated 10 July 2023, 12 months 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 β†’

Periodically patches will be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted simply close this issue (any status besides Active, Needs review or Needs work) or remove the "ProjectUpdateBotD10" tag from the issue.

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 or Needs work) 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.

  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 don't want new automated patches simply leave this issue open but remove the "ProjectUpdateBotD10" tag from the issue.

    You can use Drupal Rector yourself to make these patches.

    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 or Needs work) 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 may be useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the patch in the comment by Project Update Bot β†’ .
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.

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 Infrastructure project issue queue β†’ using the component β€œBot: Drupal Rector”.

πŸ“Œ Task
Status

Active

Version

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

  • πŸ‡©πŸ‡ͺGermany Grevil

    Checking this issue branch using PHPStan and the upgrade_status module, a few remaining D10 issues are still remaining. Which should be fixed.

  • πŸ‡©πŸ‡ͺGermany Grevil

    The module is installable under Drupal 10, the field cloning functionality is working and all "/admin/reports/fields/..." routes are all accessible.

    The only problem is, that I can not seem to use the filter function on these sites. Trying to filter anything will lead to

    A client error happened

    .

  • πŸ‡©πŸ‡ͺGermany Grevil

    Checking the recent log messages the following error is displayed as a result:

    Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "host_entity_bundle" contains a non-scalar value. in Symfony\Component\HttpKernel\HttpKernel->handle() (line 81 of /var/www/html/vendor/symfony/http-kernel/HttpKernel.php).

    This problem, isn't existent in the current 8.x-1.x version of the module, so we have to resolve it before releasing the D10 version.

  • πŸ‡©πŸ‡ͺGermany Grevil

    Ok no idea, how to resolve this issue...

    The problem either resides in "FieldList" or "FieldListTrait" and has probably something to do with the "$query_params" variable which is defined to \Drupal::request()->query->all(). $query_params['host_entity_bundle'] is an array and therefore a "non-scalar value". But I can not seem to understand where this error comes from. I commented out most of the "$query_params" occurrences, to only let the sort form render, but I am still getting the same error...

    Maybe @Anybody has an idea on how to solve this problem. But of course, anybody is free to help to solve this problem here!

  • Issue was unassigned.
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @Grevil: Looks related to https://github.com/symfony/symfony/issues/44432

    Perhaps the maintainer has an idea?

  • πŸ‡¬πŸ‡§United Kingdom joachim

    I've no idea what the Symfony exception means.

    I would try removing this line:

        $query_params = \Drupal::request()->query->all();
    

    and instead get individual param values from \Drupal::request()->query->someMethodOrOther().

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks @joachim! We'll have a further look. I think we can track this down to https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/HttpFo...
    and these lines:

    $value = parent::get($key, $this);
    
    if (null !== $value && $this !== $value && !\is_scalar($value) && !$value instanceof \Stringable) {
      throw new BadRequestException(sprintf('Input value "%s" contains a non-scalar value.', $key));
    }
    

    and yes, that behaviour was introduced in Symfony 6 (Drupal 10).

    So I'm not sure if the ->all() call is the problem or the ->get() ...
    See https://github.com/symfony/symfony/pull/41766

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @Grevil: Could you please post the whole backtrace or have a look together with me? I guess I'll be able to fix this with the provided information.

  • Status changed to Needs review over 1 year ago
  • πŸ‡©πŸ‡ͺGermany Grevil

    Fixed! The problem was a "query->get()"!

  • Status changed to RTBC over 1 year ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thank you @Grevil for solving this together very efficiently :)

    Confirming RTBC. It's fixed now.

  • First commit to issue fork.
  • πŸ‡¦πŸ‡ΊAustralia Deciphered

    I added a composer.json file so that I could use it in composer without the need for the patch, allowing me to upgrade to Drupal 10.

    The following (or similar) is required in your projects composer.json:

        "repositories": {
            "drupal": {
                "type": "composer",
                "url": "https://packages.drupal.org/8",
                "exclude": [
                    "drupal/field_tools"
                ]
            },
            "drupal/field_tools": {
                "type": "git",
                "url": "https://git.drupalcode.org/issue/field_tools-3297214.git"
            }
        },
    

    Then add the module using: composer require drupal/field_tools:dev-3297214-automated-drupal-10

    I hope this is helpful to others.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Tried to contact both maintainers, but no luck. No reply. :(

  • πŸ‡¬πŸ‡§United Kingdom joachim

    Sorry -- I'll merge this soon.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks @joachim all good :) This is open source, and we're very grateful for this great module.

  • Status changed to Needs work over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    A few things to fix:

    - The calls to ->accessCheck() should be FALSE, as we're on an admin form and we can assume the user should be able to work with all entities.

    - The commit with the composer.json should be reverted, as we don't need it -- d.org generates it automatically.

  • Status changed to Needs review over 1 year ago
  • πŸ‡©πŸ‡ͺGermany Grevil

    Done.

    • Reset the last commit on this fork's issue branch
    • Added FALSE to accessCheck()
    • joachim β†’ committed 1eb174f7 on 8.x-1.x
      Issue #3297214 by Grevil, Project Update Bot, voleger, DieterHolvoet,...
  • Status changed to Active over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    Thanks!

    Setting back to active so the bot keeps posting patches.

  • πŸ‡§πŸ‡ͺBelgium DieterHolvoet Brussels

    Should we expect more patches? Drupal 10 is released right, I feel like all necessary changes should be known by now.

  • πŸ‡―πŸ‡΅Japan tyler36 Osaka

    Drupal 10.1 is out so we should push this forward, however MR needs rebasing.

    Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.

  • Status changed to Fixed 12 months ago
  • πŸ‡©πŸ‡ͺGermany Grevil

    @tyler36 Version "8.x-1.0-alpha10" is already Drupal 10 compatible and changes from this issue have already been applied! I'd say we close this (feel free to reopen the issue @joachim, if you are against it).

  • Status changed to Active 12 months ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    The bot says to leave it open to get further patches.

  • πŸ‡―πŸ‡΅Japan tyler36 Osaka

    > The bot says to leave it open to get further patches.

    I undertood that as for the initial push though. Are you saying BP is keeping it active until Drupal 10 is stopped in a few years?

  • πŸ‡§πŸ‡ͺBelgium DieterHolvoet Brussels

    The module is D10 compatible, right? I don't see how it can be any more compatible than it is right now.

Production build 0.69.0 2024