Skip to content
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

Fixes nested array for used products cache key #21754

Conversation

michaellehmkuhl
Copy link
Contributor

Description (*)

When $requiredAttributeIds is passed as an array, it was previously being added to the $keyParts array directly, which resulted in a nested array. When this nested array is passed to getUsedProductsCacheKey(), the implode() in that function throws a notice and produces a cache key that contains the non-unique string "Array" as a part. This can result in caching errors where simple children of configurable products are concerned (e.g., swatches).

Fixed Issues (if relevant)

N/A - no existing issue found

Manual testing scenarios (*)

Call Magento\ConfigurableProduct\Model\Product\Type\Configurable::getUsedProducts($product, $requiredAttributeIds = null) passing different $requiredAttributeIds arrays of attribute codes and confirm that Magento\ConfigurableProduct\Model\Product\Type\Configurable::getUsedProducts() returns unique cache keys for each.

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)

When $requiredAttributeIds is passed as an array, it was previously being added to the $keyParts array directly, which resulted in a nested array. When this nested array is passed to getUsedProductsCacheKey(), the implode() in that function throws a notice and produces a cache key that contains the non-unique string "Array" as a part. This can result in caching errors where simple children of configurable products are concerned (e.g., swatches).
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Mar 14, 2019

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @michaellehmkuhl. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-4506 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@michaellehmkuhl thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@soleksii
Copy link

✔️ QA Passed

@magento-engcom-team magento-engcom-team merged commit c819cc0 into magento:2.3-develop Apr 8, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2019

Hi @michaellehmkuhl, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.2 milestone Apr 8, 2019
@michaellehmkuhl michaellehmkuhl deleted the electricpulp-patch-fix-used-products-cache-key branch April 8, 2019 14:26
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.

7 participants