Drupal 10 compatibility update

Created on 29 December 2022, almost 2 years ago
Updated 28 August 2024, 3 months ago

Can we create new branch for testing?
Switching to major as Drupal 10 is out now.

Happy to help maintain the module if required.

📌 Task
Status

RTBC

Version

3.0

Component

Code

Created by

🇦🇺Australia VladimirAus Brisbane, Australia

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.

  • 🇵🇱Poland Luke_Nuke

    If you guys can't wait for D10 support, you may also look into another module that covers most of the similar use cases: https://www.drupal.org/project/content_snapshot . It just had a D10 compatible release.

    Disclaimer: I'm its author and maintainer.

  • 🇩🇪Germany tobias märz

    I've got some errors with this fork on Drupal 10 and PHP8.1 and created attached patch.

  • First commit to issue fork.
  • 🇺🇦Ukraine Matroskeen 🇺🇦 Ukraine, Lutsk

    I created a new MR because the first one has some out-of-scope changes and doesn't cover all issues.
    It also includes path #5, where PHP 8.1 compatibility issues are resolved. Since Drupal 10 requires 8.1, this is required to be committed.

  • 🇺🇦Ukraine Matroskeen 🇺🇦 Ukraine, Lutsk

    Here is a patch that contains MR changes.

  • 🇧🇪Belgium ericvl

    @Matroskeen,

    First of all, thanks for the patch in #9 but I've checked the patch and find that the function "denormalize" in the file "src/Normalizer/FileEntityNormalizer.php" should also have a returnvalue of "mixed" in stead of "array|string|int|float|bool|\ArrayObject|NULL".
    Just like in all other denormalize functions in the other files.
    Can you confirm this and eventually create a new patch, please?
    Thanks

  • 🇫🇷France izus

    Hi,
    preparing for D10 migration, i needed to be compatible d10 while still in D9
    Applying #9 patch for Drupal9 and running drush updb caused the following errors

    PHP Fatal error: Declaration of Drupal\content_sync\Normalizer\ContentEntityNormalizer::supportsNormalization($data, ?string $format = null, array $context = []): bool must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization($data, $format = null) inweb\modules\contrib\content_sync\src\Normalizer\ContentEntityNormalizer.php on line 105

    Fatal error: Declaration of Drupal\content_sync\Normalizer\ContentEntityNormalizer::supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization($data, $type, $format = null) in web\modules\contrib\content_sync\src\Normalizer\ContentEntityNormalizer.php on line 113

    Fatal error: Declaration of Drupal\content_sync\Encoder\YamlEncoder::encode(mixed $data, string $format, array $context = []): string must be compatible with Symfony\Component\Serializer\Encoder\EncoderInterface::encode($data, $format, array $context = []) inweb\modules\contrib\content_sync\src\Encoder\YamlEncoder.php on line 42
    [warning] Drush command terminated abnormally.

    I managed to fix them in the following patch so that i can still in drupal 9 while using the patch in #9
    this is useless for people that are using D10 but i share it for people in my case (need to prepare D10 compatibility and still on D9)

    Hopefully it helps

  • 🇫🇷France izus

    hi,
    here is a d10 compatible patch from last dev branch

  • 🇫🇷France izus

    had a double syncContent declaration, now corrected

  • 🇫🇷France izus

    missed with syncContent
    now ok

  • 🇫🇷France izus

    had some php deprecation warning corrected

  • 🇫🇷France izus

    drush command had php warnings
    corrected too.

  • 🇫🇷France izus

    some methods signatures should be fixed, otherwise drush complains about it

  • 🇨🇦Canada blanca.esqueda

    I'll be doing some testing today, thanks for the patch!

  • Status changed to Needs work over 1 year ago
  • 🇷🇺Russia qzmenko Novosibirsk

    Fatal error during enabling module using patch #17:
    PHP Fatal error: Could not check compatibility between Drupal\content_sync\Logger\ContentSyncLog::log($level, Drupal\content_sync\Logger\Stringable|string $message, array $context = []): void and Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void, because class Drupal\content_sync\Logger\Stringable is not available in /app/web/modules/contrib/content_sync/src/Logger/ContentSyncLog.php on line 56

  • 🇫🇷France sylvain lavielle

    I had the same problem described in #17.

    It looks to me the last reliable patch is the #9 one.

    The #10 point is to be fixed too. I had an exception syncing files that is related to this point :

    [error]  TypeError: Drupal\content_sync\Normalizer\FileEntityNormalizer::denormalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, Drupal\file\Entity\File returned in Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize() (line 141 of /var/www/public/modules/contrib/content_sync/src/Normalizer/FileEntityNormalizer.php) #0 /var/www/vendor/symfony/serializer/Serializer.php(227): Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize()
    > #1 /var/www/public/modules/contrib/content_sync/src/Importer/ContentImporter.php(64): Symfony\Component\Serializer\Serializer->denormalize()
    > #2 /var/www/public/modules/contrib/content_sync/src/Form/ContentImportTrait.php(62): Drupal\content_sync\Importer\ContentImporter->importEntity()
    > #3 /var/www/vendor/drush/drush/includes/batch.inc(256): Drupal\content_sync\Commands\ContentSyncCommands->syncContent()
    > #4 /var/www/vendor/drush/drush/includes/batch.inc(201): _drush_batch_worker()
    > #5 /var/www/vendor/drush/drush/includes/batch.inc(95): _drush_batch_command()
    > #6 /var/www/vendor/drush/drush/src/Drupal/Commands/core/BatchCommands.php(20): drush_batch_command()
    > #7 [internal function]: Drush\Drupal\Commands\core\BatchCommands->process()
    > #8 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()
    > #9 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    > #10 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    > #11 /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(386): Consolidation\AnnotatedCommand\CommandProcessor->process()
    > #12 /var/www/vendor/symfony/console/Command/Command.php(312): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    > #13 /var/www/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
    > #14 /var/www/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand()
    > #15 /var/www/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun()
    > #16 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
    > #17 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
    > #18 /var/www/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run()
    > #19 /var/www/vendor/drush/drush/drush(4): require('...')
    > #20 /var/www/vendor/bin/drush(120): include('...')
    > #21 {main}. 

    The error stands in the ./src/Normalizer/FileEntityNormalizer.php class al L.74 where you have to add a return type this way in order to be working :
    public function denormalize($data, $class, $format = NULL, array $serializer_context = array()): array|string|int|float|bool|\ArrayObject|\Drupal\file\Entity\File|NULL

    ... Or define return type as "mixed"

    I guess weather a function return a so mixed and incredible bunch of types we should be entitled to use "mixed" as a return type (no, no, this isn't a sarcasm :) ) as suggested in #10

  • I am migrating to D10 and I have to handle multiple modules, before the actual upgrade of the core.
    Here is a patch based on status_upgrade checks and previous patches here.
    It is for 3.0.0-beta1 version.
    It is possible to have additional work when the upgrade to D10 is done.

  • 🇮🇳India supriyak

    I am migrating some sites from D9 to D10 for that I need to make content_sync compatible with D10.
    I tried to apply #9, #20 and #22 patches in my code, but can not make it success. So, creating another one.
    Here is a patch based on status_upgrade checks and previous patches here.
    It is for 3.0.0-beta1 version.

  • Changing the return type of normalize() method from the previous patch to make it D10 compatible.

  • Updated the previous patch with arguments.

  • First commit to issue fork.
  • 🇬🇧United Kingdom zarexogre

    How far off is a drupal 10 version of this module, happy to contribute if more work needed. Thanks

  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    Any updates on this?

  • one up , do someone can merge the patch ?

  • 🇬🇧United Kingdom zarexogre

    I tried the fork 3330173-drupal-10-compatibility-new and on content import via ui got this error so we are not there yet.

    An AJAX HTTP error occurred.
    HTTP Result Code: 500
    Debugging information follows.
    Path: /batch?id=1&op=do_nojs&op=do
    StatusText: Internal Server Error
    ResponseText: The website encountered an unexpected error. Try again later.TypeError: Drupal\content_sync\Normalizer\FileEntityNormalizer::denormalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, Drupal\file\Entity\File returned in Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize() (line 141 of modules/custom/content_sync/src/Normalizer/FileEntityNormalizer.php). Symfony\Component\Serializer\Serializer->denormalize(Array, 'Drupal\file\Entity\File', 'yaml', Array) (Line: 64)
    Drupal\content_sync\Importer\ContentImporter->importEntity(Array, Array) (Line: 62)
    Drupal\content_sync\Form\ContentSync->syncContent(Array, Array, Array) (Line: 296)

    Can we get drupal 10 version working and I will test to confirm, thanks.

  • 🇧🇪Belgium ericvl

    @zarexogre
    See also comments #10 and #20 (returnvalue must be mixed)
    Function denormalize of FileEntityNormalizer calls denormalize of parent ContentEntityNormalizer and there the retunvalue is mixed too.

  • 🇩🇪Germany tobias märz

    New patch for D10 compatibility.
    Based on 3.0.0-beta1 version.

    Hopefully i integrated everything required, to get a D10 version out.

  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    @Tobias März, your patch fails, when try to apply it.

    patch -p1 < content_sync_d10_compatiblity.patch
    The next patch would create the file LICENSE.txt,
    which already exists!  Assume -R? [n] ^C
    

    rm LICENSE.txt

    patch -p1 < content_sync_d10_compatiblity.patch
    patching file LICENSE.txt
    patching file composer.json
    patching file content_sync.info.yml
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file content_sync.info.yml.rej
    patching file content_sync.libraries.yml
    Hunk #1 FAILED at 10.
    Hunk #2 succeeded at 23 (offset 1 line).
    1 out of 2 hunks FAILED -- saving rejects to file content_sync.libraries.yml.rej
    patching file content_sync.module
    Reversed (or previously applied) patch detected!  Assume -R? [n] ^C
  • 🇩🇪Germany tobias märz

    Here is a new patch. Now it is applied correctly.

  • 🇫🇷France izus

    patch #35 worked fine for me
    Thanks

  • Status changed to RTBC 9 months ago
  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    Patch #35 works. The module works with D10 now. Thank you @Tobias März:)

  • 🇧🇪Belgium ericvl

    @Tobias März

    Thank you for your great work to make this patch but I have only one remark: this patch is based on an old beta version of Drupal 9. In the mean time, a lot of bugs were solved and modifications were done on the development branch that are not included in your version.
    Is it possible to make a patch with your modifications so that the result is Drupal 10 compatible but based on the development branch?
    Thank you.
    Eric

  • 🇧🇪Belgium ericvl

    @Tobias März

    I found that merge reauest !10 is ready and have all modification to be compatible to Drupal 10 and PHP 8.1 AND have the latest bug fixes.
    If somebody that is capable to merge, merge this in the 3.0 branch, we could have a 3.0 development branch that is D10 compatible.
    The problem is here probably that no one is capable of making a fix. What a pitty...
    Anyone out there???

  • 🇨🇦Canada blanca.esqueda

    I’ll do the merge to branch 3.0

    Regards,
    Blanca

  • 🇧🇪Belgium ericvl

    @Blanca.Esqueda

    Glad you're back.

    Be carefull to merge the correct branch. There are a lot of try-outs and you need the correct one. It is merge request !10 in branch 3330173-drupal-10-compatibility-new.

    The only 2 thinks that are still to be done before you can make a new release is, I think:
    - look at this issue 🐛 Conflict in importing nodes with images from a local system to a live system. Needs review and check the patch in comment #7. With this modification, i'm using it for months now and it fixes the bug.
    - changing the module's composer.json file so that it depends on a specific core version. The modifications should be:

    "require": {
    "drupal/core": "^9.4 || ^10.0"
    )

    It is not good to having no restrictions on the core version.

    Both modifications are tested.

    Regards,
    Eric

  • 🇩🇪Germany tobias märz

    @Blanca.Esqueda

    It would be great to get a new version.

  • 🇧🇪Belgium ericvl

    @Blanca.Esqueda

    Hello Blanca,

    If you don't find the time to make a new D10 compatible version of this great module, could you delegate this work to someone else that can do it. Version 9 of Drupal core doesn't get any security updates anymore now for some months now. So, it is adviced that we upgrade to D10.
    Thank you in advance.
    Greetings
    Eric

  • 🇬🇧United Kingdom zarexogre

    There seems like a D10 version of this module but I have tried the patches and the branches to no joy. Could someone possibly cut a new release for the D10 version please. Epic module appreciate all your work. Or explain how to get the version that works with D10 as had some issues with the patches. Thanks

  • Any update on this thread?

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3330173-D10-compatibility-beta to hidden.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3330173-drupal-10-compatibility to hidden.

  • Pipeline finished with Success
    5 months ago
    Total: 162s
    #199210
  • Status changed to Needs work 5 months ago
  • 🇵🇭Philippines mjgruta

    The latest MR breaks. We have been using this URL as patch: https://git.drupalcode.org/project/content_sync/-/merge_requests/10.diff

    [Drupal\Core\Extension\InfoParserException]
    Unable to parse modules/contrib/content_sync/content_sync.info.yml yaml_par
    se(): scanning error encountered during parsing: could not find expected ':
    ' (line 8, column 1), context while scanning a simple key (line 7, column 1
    )

  • Pipeline finished with Success
    5 months ago
    Total: 146s
    #202537
  • Status changed to RTBC 5 months ago
  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    I've downloaded the 3.0.x-dev release, applied @mjgruta's latest MR (as a patch) and changed the content_sync.info.yml file like below:

    name: 'Content Sync'
    type: module
    description: 'Allows users to import/export content using YAML files.'
    package: Custom
    core_version_requirement: ^9.4 || ^10.0
    configure: content.sync
    dependencies:
      - drupal:serialization 
    
    # Information added by Drupal.org packaging script on 2022-12-23
    version: '3.0.0-beta1+27-dev'
    project: 'content_sync'
    datestamp: 1671838601

    And activated the module.

    It works nice with Drupal 10.3.0-rc1, PHP 8.3.8 and PostgreSQL 16.1 :

    Thank you for everything.

  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    If I change the content_sync.info.yml as below, upgrade status report says that, it is compatible with D11 too.

    name: 'Content Sync'
    type: module
    description: 'Allows users to import/export content using YAML files.'
    package: Custom
    core_version_requirement: ^9.4 || ^10.0 || ^11
    configure: content.sync
    dependencies:
      - drupal:serialization 
    
    # Information added by Drupal.org packaging script on 2022-12-23
    version: '3.0.0-beta1+27-dev'
    project: 'content_sync'
    datestamp: 1671838601

    Please publish the dev release with this changes:) I'm excited to put this in to my CI/CD flows:)

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Truly, this issue aims to add compatibility only with Drupal 10.

  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    @apaderno, you're right. Thanks for correcting.

  • I'm also hoping for this functionality with D10 compatibility and wondered about the status. Is it planned soon, or should I try as #50?

  • Update. I tried the method described by @orkut-murat-yılmaz in #50 but it does not work for me. I get error messages on both cli and GUI attempts to install or uninstall, and nothing for the module appears in my admin/config page under Development (or anywhere).

    @orkut-murat-yılmaz - when you said "@mjgruta's latest MR (as a patch)" did you mean e0ef7263 - Update content_sync.info.yml, invalid indentation? That is the one I applied...

    Error messages:

    # drush pm-install content_sync
     [warning] Drush command terminated abnormally.

    GUI install from admin/modules page gives a "This website encountered an unexpected error."

    But if I try again, then it says it was already installed...

    # drush -vv pm-install content_sync
     [info] Drush bootstrap phase: bootstrapDrupalRoot()
     [info] Change working directory to /home2/suchimyj/SUCHIM.stage/web
     [info] Initialized Drupal 10.3.2 root directory at /home2/suchimyj/SUCHIM.stage/web
     [info] Drush bootstrap phase: bootstrapDrupalSite()
     [info] Initialized Drupal site default at sites/default
     [info] Drush bootstrap phase: bootstrapDrupalConfiguration()
     [info] Drush bootstrap phase: bootstrapDrupalDatabase()
     [info] Successfully connected to the Drupal database.
     [info] Drush bootstrap phase: bootstrapDrupalFull()
     [info] Starting bootstrap to none
     [info] Drush bootstrap phase 0
     [info] Try to validate bootstrap phase 0
     [notice] Already enabled: content_sync

    Yet, nothing is added to admin pages.

    And if I try to uninstall, I get this error:

    # drush pmu content_sync
    
    In PmCommands.php line 175:
                                                                                         
      The following module(s) are not installed: content_sync. No modules to uninstall.  
    

    Yet, GUI shows it in Uninstall page. Though trying to uninstall again gets "The website encountered an unexpected error. Try again later." error.
    Trying again did work though, contrary to what drush reports.

    Help?

    This module looks like just what I need right now ... if only I could get it to work. Thanks.

  • 🇩🇪Germany guido_s Cologne

    The last information I have from @Blanca.Esqueda is that she already wanted to do a d10 release about a month ago and that she is waiting for some features some other developers are currently working on.
    As I didn't get any replies on new messages, I don't know what the current status is.

    But my colleague informed me about another module single_content_sync which already has a d10 release and provided everything we needed for our use case.
    Maybe this might help some of you which are in need of content sync features for d10. It doesn't support commerce products out of the box though and some other more special field types. But it can be extended.

  • @guido_s - Thank you for the update. I hope it will happen soon! Meanwhile, also thanks for the info on single_content_sync. I will give it a try.

  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Seems to me that maintainers are not interested in doing the release.
    I contacted them more that a year a ago and the response was exactly the same. 🤖
    I'd recommend to people still using it creating a fork for D10 and D11+ support.

  • @guido_s = Thank you for the alternative suggestion. The Single Content Sync module works great for my use case!

    @vladimiraus - Noted, thanks.

  • 🇨🇦Canada blanca.esqueda

    Closing this task as the code has been merged to 3.0.x-dev

    Thanks: izus, vladimiraus, NikolaAt, tobias märz, matroskeen, avpaderno, java008, sylvain lavielle, supriyak, sahal_va, mjgruta, orkut murat yılmaz, ericvl, leeksoup, zarexogre, Luke_Nuke, guido_s, socieboy, qzmenko, alexandre.baron@symetris.com

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

Production build 0.71.5 2024