Resolve D10 compatibility issues

Created on 18 September 2025, 20 days ago

Problem/Motivation

I've tried to run a migration in Drupal 10.4 and ran into a couple of issues:

1. Serializer issue
TypeError: Drupal\ai_migration\AiMigrator::__construct(): Argument #5 ($serializer) must be of type Drupal\serialization\Serializer\Serializer, Symfony\Component\Serializer\Serializer given, called in /app/html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 in Drupal\ai_migration\AiMigrator->__construct() (line 100 of /app/html/modules/contrib/ai_migration/src/AiMigrator.php)

It looks like Drupal\serialization\Serializer\Serializer came on the scent in Drupal 11.2 (the MR in question).

So, instead we can use Symfony\Component\Serializer\Serializer, which should also be valid in Drupal 11.

2. DomCrawler

Error: Class "Symfony\Component\DomCrawler\Crawler" not found in Drupal\ai_migration\Service\HtmlContentProcessor->extractFromContainer() (line 246 of /app/html/modules/contrib/ai_migration/src/Service/HtmlContentProcessor.php)

symfony/dom-crawler is already required in Drupal 11 core-dev, but is not required in Drupal 10, so we need to include this in our composer.json.

3. CSS Selector

In Crawler.php line 1222:
                                                                               
  To filter with a CSS selector, install the CssSelector component ("composer  
   require symfony/css-selector"). Or use filterXpath instead.   

So, we also need to include symfony/css-selector in our composer.json.

After resolving these locally, I could successfully run a migration. So, we just need to clean these up -- and make sure GitLab runs tests in Drupal 10, as well.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States majorrobot

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.

Production build 0.71.5 2024