Problem/Motivation

When updating to 1.1.11 of this module and running `drush updb` to execute database updates, the `acquia_dam_update_9020` hook fails with the following error:

[warning] Undefined array key "image_style" Image.php:110 [error] TypeError: Drupal\acquia_dam\ImageStyleHelper::addAllowedImageStyle(): Argument #1 ($style) must be of type string, null given, called in /web/modules/contrib/acquia_dam/src/Plugin/media/acquia_dam/Image.php on line 116

Proposed resolution

Use the null coalescing operator when accessing potentially undefined array keys, an check that $style_value is not empty before passing to addAllowedImageStyle()

CommentFileSizeAuthor
#2 3575825-2.patch884 bytescindytwilliams

Issue fork acquia_dam-3575825

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cindytwilliams created an issue. See original summary.

cindytwilliams’s picture

Status: Active » Needs review
StatusFileSize
new884 bytes

This patch fixes the TypeError in Image::setSettings() by:

  1. Use the null coalescing operator when accessing potentially undefined array keys
  2. Check that $style_value is not empty before passing to addAllowedImageStyle()

This allows acquia_dam_update_9020 to complete successfully without errors.

rajeshreeputra made their first commit to this issue’s fork.

amangrover90’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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