Drupal 10 compatibility fixes

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

Fixed

Version

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

  • 🇺🇸United States bob.hinrichs

    Any chance a release could be made soon?

  • 🇳🇱Netherlands megachriz

    @bob.hinrichs
    Perhaps an additional co-maintainer is needed for that, the current maintainers have quite a long list of projects that they maintain.
    This project is listed on the Drupal 10 readiness project adoption spreadsheet. See also #3342443: META: Adopt contributed projects for Drupal 10 readiness for this initiative.

  • 🇬🇧United Kingdom robcarr Perthshire, Scotland

    Thank you for the work on the patch.
    The patched module applies to D10.1, but I don't seem to be able to enable the 'Markdown' filter with CKEditor5. All the text is present in the text format config page, but the toggle is disabled

    Is there a possible filter or config clash preventing this?

  • Status changed to RTBC almost 2 years ago
  • 🇬🇧United Kingdom robcarr Perthshire, Scotland

    I have this running on D10.1. Doesn't seem to be any other issue preventing it working with D10...?

  • 🇺🇸United States hyperlogos

    Patch is very not working for me on D10. I can't properly uninstall the module and it breaks /admin/config/ and other pages on my [test] site. I haven't even got to the point of adding the filter to an input format, all I did was enable the module. Maybe I did it wrong? Patch 20 applied cleanly.

    Is devel doing something bad here, or is that error just a symptom? (See bottom)

    e.g. /admin/modules/uninstall

    Deprecated function: Return type of Drupal\markdown\Annotation\AnnotationObject::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 19 of /var/www/sites/drupal/web/modules/dev/markdown/src/Annotation/AnnotationObject.php). =>

    array:66 [▼
      "65: include()" => array:2 [▶]
      "64: Composer\Autoload\{closure}()" => array:2 [▶]
      "63: Composer\Autoload\ClassLoader->loadClass()" => array:2 [▶]
      "62: include()" => array:2 [▶]
      "61: Composer\Autoload\{closure}()" => array:2 [▶]
      "60: Composer\Autoload\ClassLoader->loadClass()" => array:2 [▶]
      "59: include()" => array:2 [▶]
      "58: Composer\Autoload\{closure}()" => array:2 [▶]
      "57: Composer\Autoload\ClassLoader->loadClass()" => array:2 [▶]
      "56: apcu_fetch()" => array:1 [▶]
      "55: Drupal\Core\Cache\ApcuBackend->getMultiple()" => array:2 [▶]
      "54: Drupal\Core\Cache\ChainedFastBackend->getMultiple()" => array:2 [▶]
      "53: Drupal\Core\Cache\ChainedFastBackend->get()" => array:2 [▶]
      "52: Drupal\Core\Plugin\DefaultPluginManager->cacheGet()" => array:2 [▶]
      "51: Drupal\markdown\PluginManager\InstallablePluginManager->getCachedDefinitions()" => array:2 [▶]
      "50: Drupal\markdown\PluginManager\InstallablePluginManager->getRuntimeDefinitions()" => array:1 [▶]
      "49: Drupal\markdown\PluginManager\InstallablePluginManager->getDefinitions()" => array:1 [▶]
      "48: Drupal\Core\Plugin\DefaultPluginManager->getDefinition()" => array:2 [▶]
      "47: Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()" => array:2 [▶]
      "46: Drupal\Component\Plugin\PluginManagerBase->createInstance()" => array:2 [▶]
      "45: Drupal\markdown\PluginManager\InstallablePluginManager->createInstance()" => array:2 [▶]
      "44: Drupal\markdown\PluginManager\ParserManager->createInstance()" => array:2 [▶]
      "43: Drupal\markdown\PluginManager\ParserManager->getDefaultParser()" => array:1 [▶]
      "42: Drupal\markdown\Plugin\Filter\FilterMarkdown->setConfiguration()" => array:2 [▶]
      "41: Drupal\filter\Plugin\FilterBase->__construct()" => array:2 [▶]
      "40: Drupal\markdown\Plugin\Filter\FilterMarkdown->__construct()" => array:2 [▶]
      "39: Drupal\markdown\Plugin\Filter\FilterMarkdown::create()" => array:2 [▶]
      "38: Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()" => array:2 [▶]
      "37: Drupal\Component\Plugin\PluginManagerBase->createInstance()" => array:2 [▶]
      "36: Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin()" => array:2 [▶]
      "35: Drupal\filter\FilterPluginCollection->initializePlugin()" => array:2 [▶]
      "34: Drupal\filter\FilterPluginCollection->getAll()" => array:1 [▶]
      "33: Drupal\filter\FilterPluginCollection->sort()" => array:1 [▶]
      "32: Drupal\filter\Entity\FilterFormat->filters()" => array:1 [▶]
      "31: markdown_filter_format_load()" => array:2 [▶]
      "30: Drupal\Core\Entity\EntityStorageBase->Drupal\Core\Entity\{closure}()" => array:2 [▶]
      "29: Drupal\Core\Extension\ModuleHandler->invokeAllWith()" => array:2 [▶]
      "28: Drupal\Core\Entity\EntityStorageBase->postLoad()" => array:2 [▶]
      "27: Drupal\Core\Entity\EntityStorageBase->loadMultiple()" => array:2 [▶]
      "26: Drupal\Core\Entity\EntityStorageBase->loadByProperties()" => array:2 [▶]
      "25: Drupal\filter\FilterUninstallValidator->getEnabledFilterFormats()" => array:1 [▶]
      "24: Drupal\filter\FilterUninstallValidator->validate()" => array:2 [▶]
      "23: Drupal\Core\Extension\ModuleInstaller->validateUninstall()" => array:2 [▶]
      "22: Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall()" => array:2 [▶]
      "21: Drupal\system\Form\ModulesUninstallForm->buildForm()" => array:2 [▶]
      "20: call_user_func_array()" => array:1 [▶]
      "19: Drupal\Core\Form\FormBuilder->retrieveForm()" => array:2 [▶]
      "18: Drupal\Core\Form\FormBuilder->buildForm()" => array:2 [▶]
      "17: Drupal\Core\Controller\FormController->getContentResult()" => array:2 [▶]
      "16: call_user_func_array()" => array:1 [▶]
      "15: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
      "14: Drupal\Core\Render\Renderer->executeInRenderContext()" => array:2 [▶]
      "13: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()" => array:2 [▶]
      "12: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
      "11: Symfony\Component\HttpKernel\HttpKernel->handleRaw()" => array:2 [▶]
      "10: Symfony\Component\HttpKernel\HttpKernel->handle()" => array:2 [▶]
      " 9: Drupal\Core\StackMiddleware\Session->handle()" => array:2 [▶]
      " 8: Drupal\Core\StackMiddleware\KernelPreHandle->handle()" => array:2 [▶]
      " 7: Drupal\page_cache\StackMiddleware\PageCache->pass()" => array:2 [▶]
      " 6: Drupal\page_cache\StackMiddleware\PageCache->handle()" => array:2 [▶]
      " 5: Drupal\ban\BanMiddleware->handle()" => array:2 [▶]
      " 4: Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()" => array:2 [▶]
      " 3: Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()" => array:2 [▶]
      " 2: Drupal\Core\StackMiddleware\StackedHttpKernel->handle()" => array:2 [▶]
      " 1: Drupal\Core\DrupalKernel->handle()" => array:2 [▶]
      " 0: main()" => array:2 [▶]
    ]

    [...]

    The website encountered an unexpected error. Please try again later.
    RuntimeException: Failed to start the session because headers have already been sent by "/var/www/sites/drupal/web/modules/contrib/devel/devel.module" at line 270. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 132 of /var/www/sites/drupal/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

    Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (Line: 144)
    Drupal\Core\Session\SessionManager->startNow() (Line: 109)
    Drupal\Core\Session\SessionManager->start() (Line: 59)
    Symfony\Component\HttpFoundation\Session\Session->start() (Line: 240)
    Drupal\big_pipe\Render\BigPipe->performPreSendTasks() (Line: 295)
    Drupal\big_pipe\Render\BigPipe->sendContent() (Line: 112)
    Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 377)
    Symfony\Component\HttpFoundation\Response->send() (Line: 20)

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    1 pass
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    1 pass
  • 🇺🇸United States markdorison

    I pushed a couple of additional fixes to the MR.

    1. I updated the minimum version requirement to 9.1: Usage of symfony-cmf/routing dependency deprecated in 9.1 and removed in 10.0. I replaced usage of Symfony\Cmf\Component\Routing\RouteObjectInterface with Drupal\Core\Routing\RouteObjectInterface and adjusted support to 9.1 or later.
    2. I replaced an additional usage of CacheableResponse::create() related to Since symfony/http-foundation 5.1: The "Symfony\Component\HttpFoundation\Response::create()" method is deprecated, use "new Drupal\Core\Render\HtmlResponse()" instead .

    Further testing is needed.

  • 🇺🇸United States ultimike Florida, USA

    Thanks to everyone working on this patch - very much appreciated.

    I just tried it on a Drupal 10.1 site, using both the patch from #22 as well as the patch from comment 25 on 🐛 Error when using markdown module with PHP 8.1 on Drupal 9.3 Needs review .

    Unfortunately, I get a fatal error when trying to do anything with the site, including `drush updb` and `drush cr`. The error is:

    $ drush cr
    Error: Class "Twig_Extension" not found in /var/www/html/web/modules/contrib/markdown/src/Twig/Extension.php on line 10 #0 /var/www/html/vendor/composer/ClassLoader.php(582): include()

    I'm happy to provide the rest of the stack trace if requested.

    -mike

  • 🇩🇪Germany Anybody Porta Westfalica

    Drupal 9 EOL is close :)

  • Status changed to Needs work over 1 year ago
  • 🇳🇴Norway gisle Norway

    Changing 'Status' based upon comment #25.

  • Status changed to Postponed over 1 year ago
  • 🇩🇪Germany Grevil

    Hence, 🐛 Error when using markdown module with PHP 8.1 on Drupal 9.3 Needs review and this issue have both quite a long list of changes, and do very similar things (in terms of solving deprecations), I suggest we first test and finish 🐛 Error when using markdown module with PHP 8.1 on Drupal 9.3 Needs review on Drupal 9, and when we are in the clear, we can tackle this issue!

    POSTPONED on 🐛 Error when using markdown module with PHP 8.1 on Drupal 9.3 Needs review .

  • 🇺🇸United States ultimike Florida, USA

    With this module not yet ready for Drupal 10, and (IMHO) it being a bit complex for my needs, I wrote a new Markdown Easy module. It is a bit more opinionated, but vastly simpler to use (and ready for Drupal 10).

    It's early days, but the code of Markdown Easy is pretty straight-forward, and I'm determined to keep it that way.

  • 🇬🇧United Kingdom malcomio

    When I tried with the patch from #23, I encountered the same errors mentioned in #25.

    However, I exported the merge request to a patch, and that seems to work as expected from my testing so far.

    We also have this patch applied: https://www.drupal.org/files/issues/2023-04-21/3265416-markdown-php-81-2...

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Build Successful
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States markdorison

    🐛 Error when using markdown module with PHP 8.1 on Drupal 9.3 Needs review has been committed. Putting this back to needs review. Please review and make updates to the merge request (if possible) to keep changes in one place.

  • 🇺🇸United States mradcliffe USA

    Manual testing results:

    1. I was able to apply a patch made from 4c550fcb333d69c674397edfd3d3efcc4745d29f in Merge Request 20 using mglaman/composer-drupal-lenient alongside league/commonmark:^1.0 on Drupal 10.0.x on a ddev instance with PHP 8.1.

    command: composer require drupal/markdown:dev-3.0.x league/commonmark:^1

    ./composer.json has been updated
    Running composer update drupal/markdown league/commonmark
    Gathering patches for root package.
    Loading composer repositories with package information                                                                                                                         Updating dependencies                                 
    Lock file operations: 2 installs, 0 updates, 0 removals
      - Locking drupal/markdown (dev-3.0.x 67e14f2)
      - Locking league/commonmark (1.6.7)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 2 installs, 0 updates, 0 removals
      - Syncing drupal/markdown (dev-3.0.x 67e14f2) into cache
      - Downloading league/commonmark (1.6.7)
    Gathering patches for root package.
    Gathering patches for dependencies. This might take a minute.
      - Installing drupal/markdown (dev-3.0.x 67e14f2): Cloning 67e14f273b from cache
      - Installing league/commonmark (1.6.7): Extracting archive
      - Applying patches for drupal/markdown
        patches/markdown-3288447-20.patch (3288447)
    

    2. I enabled the module.
    3. Then I went into the Markdown Configuration page and saw both Commonmark and Commonmark GFM listed.
    4. Then I clicked the Edit button and was able to configure and save options for the parsers.
    5. Then I created a text format and added Markdown as an input filter.
    7. All of the markdown.parser.* and filter.format.* configuration was successfully exported using a configuration synchronization.
    8. I created a node using the text format, and markdown was parsed into HTML per my configuration.

    For me this is +1 for league/commonmark. I know there are some code standard issues with using \Drupal object.

  • 🇺🇸United States zanematthew Baltimore, MD

    Based on #30 are others planning to migrate to that module, or continue addressing the issues in the current module?

  • Status changed to RTBC over 1 year ago
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024