New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent smarty variable-leak #1820

Closed
wants to merge 1 commit into
base: 5.5
from

Conversation

Projects
None yet
3 participants
@screeny05
Member

screeny05 commented Oct 1, 2018

The Emotion Banner-Slider has a mechanism which uses a given images' thumbnails when available. If there is none available (not generated / folder doesn't generate thumbanils), the element won't get a srcset and sizes attribute.

The problem arises, when the first image, given to the banner-slider has thumbnails, but the second image has not. Due to the way smarty variable-scoping works, the variables $srcSet and $itemSet will get re-used, because they are not overridden outside of the {if $banner.thumbnails}.

1. Why is this change necessary?

In order to prevent this leak, we have to reset these both variables for every image.

2. What does this change do, exactly?

Reset the variables $srcSet and $itemSet for every media-element given to the banner-slider.

3. Describe each step to reproduce the issue or behaviour.

  1. Add a Banner-Slider to a Shoppingworld
  2. Add an Image to the banner-slider which has thumbnails
  3. Add a second Image to the banner-slider which has no thumbnails (e.g. by creating a new sub-album of the "Einkaufswelten"-Album, which has no thumbnails configured)

The Frontend should now properly display the first image in the banner-slider. The second one however will be a copy of the first one, because the $srcSet variable leaked from the last {foreach}-run.

4. Please link to the relevant issues (if any).

5. Which documentation changes (if any) need to be made because of this PR?

None

6. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfil them.
@shopwareBot

This comment has been minimized.

Show comment
Hide comment
@shopwareBot

shopwareBot Oct 2, 2018

Hello,

thank you for creating this pull request.
I have opened an issue on our Issue Tracker for you. See the issue link: https://issues.shopware.com/issues/SW-22677

Please use this issue to track the state of your pull request.

shopwareBot commented Oct 2, 2018

Hello,

thank you for creating this pull request.
I have opened an issue on our Issue Tracker for you. See the issue link: https://issues.shopware.com/issues/SW-22677

Please use this issue to track the state of your pull request.

shopwareBot pushed a commit that referenced this pull request Oct 4, 2018

Merge pull request #7022 in SW/shopware from sw-22677/5.5/auto-import…
…ed-from-github to 5.5

* commit '4ef58bd71e7f3f2fab165932da9d3b5ca1de2388':
  SW-22677 - Update Upgrade.md
  SW-22677 - Prevent smarty variable-leak fixes #1820
@shopwareBot

This comment has been minimized.

Show comment
Hide comment
@shopwareBot

shopwareBot Oct 4, 2018

Hi @screeny05, thank you very much for your contribution! 💙

shopwareBot commented Oct 4, 2018

Hi @screeny05, thank you very much for your contribution! 💙

tinect added a commit to tinect/shopware that referenced this pull request Oct 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment