-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
#13612 Fixed-Quantity_and_stock_status when visibility set to storefront throwing exception #20001
#13612 Fixed-Quantity_and_stock_status when visibility set to storefront throwing exception #20001
Conversation
Hi @aditisinghcedcoss. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@@ -73,7 +73,7 @@ public function getOptionText($value) | |||
} | |||
} | |||
// End | |||
if (isset($options[$value])) { | |||
if (is_null($value) === false && is_array($value) === false && isset($options) && isset($options[$value])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Array keys can only be scalar, but $value is an array.
It looks like it's enough to check is_scalar($value)
. Please update code and do amend commit.
Condition like is_null($value) === false
looks really odd and is never a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aditisinghcedcoss, only those checks are needed:
is_scalar($value) && isset($options[$value])
Please squash changes into a single commit and do a force push.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8dc2060
to
0df7243
Compare
Hi @orlangur, thank you for the review. |
@aditisinghcedcoss thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
Hi @aditisinghcedcoss, thank you for your contribution! |
Draft release note: Infrastructure Added an |
Description (*)
The function
getOptionText
expects params as string or integer and in case ofquantity_and_stock_status
when visibility set to storefront , array passed togetOptionText
which can be handled by addingis_scalar
check for param$value
.Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)