Automated Drupal 10 compatibility fixes

Created on 15 June 2022, over 2 years ago
Updated 22 March 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

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.

  • heddn Nicaragua

    I made a few tweaks to the patch to allow tests to run on 10.x. And some type hints. Did full manual testing using png and jpg images in 10.1. Reviewed the module's code. Pretty simple code at work here.

    • heddn → committed 2e8fc10b on 8.x-1.x
      Issue #3287987 by heddn: Automated Drupal 10 compatibility fixes
      
  • Status changed to Fixed over 1 year ago
  • heddn Nicaragua

    This one bites the dust now too.

  • Status changed to Active over 1 year ago
  • 🇹🇭Thailand Nick Hope

    Unfortunately this breaks Drupal 9.5.5 with PHP 7.4.23, and I think it's because of the PHP version.

    I don't know if PHP 7.4 is officially support for D9 or not. This page → says it is supported, but my /admin/reports/status page says "Drupal requires at least PHP 8.0". I don't know which is correct.

    This is the first module (of many) that I've had this problem with, so maybe the patch doesn't really require the part that is incompatible with PHP 7?

    If PHP 7 really is still supposed to be supported by D8/9, and a D10-compatibility patch for ISQ cannot retain compatibility for D8/9 with PHP 7, I guess separate ISQ branches would be required for D10 and D8/9.

    Happy to raise a new issue if you wish.

    Full error message below:

    The website encountered an unexpected error. Please try again later.
    ParseError: syntax error, unexpected 'static' (T_STATIC) in Composer\Autoload\includeFile() (line 39 of modules\contrib\image_style_quality\src\Plugin\ImageEffect\ImageStyleQualityImageEffect.php).
    
    Composer\Autoload\includeFile() (Line: 428)
    Composer\Autoload\ClassLoader->loadClass()
    spl_autoload_call()
    class_exists() (Line: 96)
    Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (Line: 17)
    Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 83)
    Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 81)
    Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin() (Line: 80)
    Drupal\Component\Plugin\LazyPluginCollection->get() (Line: 18)
    Drupal\image\ImageEffectPluginCollection->get() (Line: 25)
    Drupal\image\ImageEffectPluginCollection->sortHelper()
    uasort() (Line: 90)
    Drupal\Core\Plugin\DefaultLazyPluginCollection->sort() (Line: 403)
    Drupal\image\Entity\ImageStyle->getEffects() (Line: 346)
    Drupal\image\Entity\ImageStyle->transformDimensions() (Line: 263)
    template_preprocess_image_style()
    call_user_func_array() (Line: 287)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 48)
    __TwigTemplate_725c3eac57c1d63d38008a5aee6dee46cf281e2b76b0191b0744ea2937dfed41->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 88)
    __TwigTemplate_8e5ae62046cbce6735196bd3b694db435c4d49688fd8723e6415057646147c0b->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 56)
    __TwigTemplate_0f802d884b09d6ff263d4a13023446741ce5a6293779ee523e07f37cb9a726ae->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 1161)
    Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender() (Line: 238)
    template_preprocess_views_view_field()
    call_user_func_array() (Line: 287)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 1748)
    Drupal\views\Plugin\views\field\FieldPluginBase->theme() (Line: 774)
    Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow()
    call_user_func_array() (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 788)
    Drupal\Core\Render\Renderer->doCallback() (Line: 374)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 713)
    Drupal\views\Plugin\views\style\StylePluginBase->renderFields() (Line: 579)
    Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping() (Line: 470)
    Drupal\views\Plugin\views\style\StylePluginBase->render() (Line: 2169)
    Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1538)
    Drupal\views\ViewExecutable->render() (Line: 131)
    Drupal\views\Plugin\views\display\Block->execute() (Line: 1635)
    Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
    Drupal\views\Element\View::preRenderViewElement() (Line: 59)
    Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 171)
    Drupal\block\BlockViewBuilder::preRender()
    call_user_func_array() (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 788)
    Drupal\Core\Render\Renderer->doCallback() (Line: 374)
    Drupal\Core\Render\Renderer->doRender() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 82)
    __TwigTemplate_ae98965f5edd2e1ec22b7d121fa96a43564523b90a2900819b9d000386bca5f6->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 86)
    __TwigTemplate_c1fc1e06b1efb7eb88ed4ea9621504c98e494bf6050ac21968d3e85ebfcc1ac3->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 162)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 163)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    call_user_func() (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
  • Status changed to Needs work over 1 year ago
  • heddn Nicaragua

    @Nick Hope can you provide a patch to fix this? Sorry this broke you.

  • 🇹🇭Thailand Nick Hope

    @heddn I don't have much coding experience so I'm not confident enough to "assign" the issue to myself, but I'll have a look at it.

  • 🇫🇮Finland Kimitri

    @nick-hope We ran into the same problem. The problem is that the static return type was introduced in PHP 8.0. I made a quick patch that just removes the return type from the method.

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

Production build 0.71.5 2024