Two news items with the same tag create PHP error

Created on 16 December 2024, 4 months ago

Problem/Motivation

When you create two news item with the same tag (taxonomy term), you get the following error message:

The website encountered an unexpected error. Try again later.

Error: Call to a member function transformDimensions() on null in template_preprocess_image_style() (line 87 of core/modules/image/image.module).

Steps to reproduce

  1. Install Drupal CMS or run ddev rebuild on existing installation.
  2. In the visual installer enable the recipe for News.
  3. Create a news and give it a tag (taxonomy term).
  4. Create another news and give it the same tag.
  5. After saving the error above appears.

The above only happens with News. To validate I tried again and enabled the recipe for Blog and News. For Blog I could create multiple nodes using the same tag (in my case Drupal). I could also create a News node with the smame tag. But as soon as I create a second News node with the tag Drupal above error occurs.

This should be fixed until launch.

πŸ› Bug report
Status

Active

Component

General

Created by

πŸ‡©πŸ‡ͺGermany breidert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @breidert
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    That seems like a pretty serious bug, so tagging it as a stable blocker until it is decided otherwise.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I am definitely reproducing this.

    Backtrace, for reference:

    The website encountered an unexpected error. Try again later.
    
    Error: Call to a member function transformDimensions() on null in template_preprocess_image_style() (line 87 of core/modules/image/image.module).
    
    call_user_func_array() (Line: 261)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 53)
    __TwigTemplate_1ff83289682f21028757bd0808f692fc->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 93)
    __TwigTemplate_5254262a3236e53e09e68a3c9a280e56->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 100)
    __TwigTemplate_faf585ef680721184a0d202cbeb119b8->block_content() (Line: 431)
    Twig\Template->yieldBlock() (Line: 79)
    __TwigTemplate_faf585ef680721184a0d202cbeb119b8->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 57)
    __TwigTemplate_5cef5491d6a171a2b7694c815ce59500->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 280)
    __TwigTemplate_43552b7e41adc99aecd3af3de91dfda4___724238295->block_content() (Line: 431)
    Twig\Template->yieldBlock() (Line: 80)
    __TwigTemplate_ab1c68a97f783bee192a268251f00580->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 172)
    __TwigTemplate_43552b7e41adc99aecd3af3de91dfda4___724238295->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 58)
    __TwigTemplate_43552b7e41adc99aecd3af3de91dfda4->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 65)
    __TwigTemplate_13ee6ef994dce1540561c47bd6472299->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 115)
    __TwigTemplate_83e6008306731c49108f5a0790bf896b->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 100)
    __TwigTemplate_faf585ef680721184a0d202cbeb119b8->block_content() (Line: 431)
    Twig\Template->yieldBlock() (Line: 79)
    __TwigTemplate_faf585ef680721184a0d202cbeb119b8->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 57)
    __TwigTemplate_5cef5491d6a171a2b7694c815ce59500->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 459)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 137)
    __TwigTemplate_d95770760268ba8df55789bbc17d8ae4->doDisplay() (Line: 387)
    Twig\Template->yield() (Line: 343)
    Twig\Template->display() (Line: 358)
    Twig\Template->render() (Line: 35)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
    Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
    Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
    Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Quickly traced this to the fact that the News teaser display, and only the News teaser display, is referencing an image style called medium_focal_point, which doesn't exist.

    News was originally created as a clone of Blog so how this happened, I am not sure.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Great find, straightforward fix. Added test coverage to prevent this from regressing again. Thanks @breidert! Assigning to you for review.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡¬πŸ‡§United Kingdom tonypaulbarker Leeds

    The configuration should probably match blog, so I think this should be set to use β€˜β€™Small’ view mode. This happened because the configuration was created without knowledge of stuff that wasn’t merged yet and didn’t have functional tests. As far as git was concerned, there were no conflicts.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    @tonypaulbarker - that's exactly what I did. It matches Blog's teaser view. Did I miss something?

  • πŸ‡¬πŸ‡§United Kingdom tonypaulbarker Leeds

    @phenaproxima perfect!

    News was originally created as a clone of Blog so how this happened, I am not sure.

    Trying to give a little insight into this. I checked and updated every instance I had knowledge of but some work in progress like this one likely slipped through the net.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    @tonypaulbarker makes sense, it's no drama at all but good to have an explanation for these sorts of mysteries.

    Confirmed the issue and this fixes it :)

  • Pipeline finished with Skipped
    4 months ago
    #370514
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Bug thoroughly smashed. Merged into 1.x, thanks!

  • πŸ‡©πŸ‡ͺGermany breidert

    I can confirm it works. For testing I pulled the latest version of 1.x branch and ran ddev rebuild. After installation of News recipe I could create two news with the same tag.

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

Production build 0.71.5 2024