imagecache_external unmet dependency

Created on 15 August 2023, about 1 year ago
Updated 9 November 2023, about 1 year ago

Problem/Motivation

TypeError: Drupal\easy_responsive_images\TwigExtension\ImageUrl::createImageUrl(): Return value must be of type array, none returned in Drupal\easy_responsive_images\TwigExtension\ImageUrl::createImageUrl() (line 90 of modules/contrib/easy_responsive_images/src/TwigExtension/ImageUrl.php).

Steps to reproduce

Using the |image_url filter defined in this module causes the above error. It stems from line 56 of easy_responsive_images/-/blob/1.3.x/src/TwigExtension/ImageUrl.php

Proposed resolution

Add imagecache_external as a module dependency. (gimme just a sec, need an issue #)

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

1.3

Component

Code

Created by

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

Comments & Activities

  • Issue created by @JSchref
  • It is worth noting that, if this module isn't found, createImageUrl() doesn't have a return at all, and a better defensive coding solution should be sought.

  • @jschref opened merge request.
  • Apparently patching info.yml files is extra fun? No change, just fewer lines in the patch.

  • 🇳🇱Netherlands seanB Netherlands

    The createImageUrl() method contains a check for the module. So it is definitely not a required dependency, the support for it is optional.

        // If we do not have a stream wrapper, it might be an external URL. If the
        // imagecache_external module is installed, try to get a local URI using
        // that module.
        if (\Drupal::moduleHandler()->moduleExists('imagecache_external')) {
          $stream_wrapper = \Drupal::service('stream_wrapper_manager')->getViaUri($uri);
          if (!$stream_wrapper) {
            $uri = imagecache_external_generate_path($uri);
          }
        }
    
  • What does createImageUrl() return if uri is truthy and \Drupal::moduleHandler()->moduleExists('imagecache_external') is falsy?

  • 🇳🇱Netherlands seanB Netherlands

    Yeah, I don't think you need that patch anymore. The type hint changes are committed and should solve the issue. Could you confirm this and close this issue if it is resolved?

  • Status changed to Closed: works as designed about 1 year ago
  • 🇳🇱Netherlands seanB Netherlands

    Closing the issue for now.

Production build 0.71.5 2024