Skip to content

Conversation

@ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Jan 31, 2018

Description

Image builder is used few times with different parameters in \Magento\Catalog\Block\Product\AbstractProduct::getImage.
In case when on first call $attributes was set to not empty array, on second call - $attributes is empty array - builder re-used attributes from first call, as result - we will get unexpected result - attributes will be re-used from 1st call.

$this->imageBuilder->setProduct($product)
    ->setImageId($imageId)
    ->setAttributes($attributes)
    ->create();

As builder designed to be used multiple times - let's remove check that attributes array is not empty.

Fixed Issues (if relevant)

N/A

Manual testing scenarios

See description

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…e times

Extract test data with and without attributes to separate methods
@rogyar rogyar self-assigned this Feb 7, 2018
@rogyar rogyar added this to the February 2018 milestone Feb 7, 2018
@magento-engcom-team magento-engcom-team merged commit 775ec3a into magento:2.2-develop Feb 15, 2018
magento-engcom-team pushed a commit that referenced this pull request Feb 15, 2018
@ihor-sviziev ihor-sviziev deleted the product-image-builder-fix-issue-with-set-attributes branch February 16, 2018 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants