-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
MAGETWO-81311: Check the length of the array before attempting to sli… #11637
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ce it. Slicing an array of one will create an empty result. Issue: 9944
@@ -119,7 +119,7 @@ define([ | |||
this._super(); | |||
|
|||
scope = this.dataScope; | |||
name = scope.split('.').slice(1); | |||
name = scope.split('.').length > 1 ? scope.split('.').slice(1) : scope.split('.'); |
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.
I think would be great to extract scope.split('.') to variable in order not to calculate it 3 times
…. scope variable is not used anywhere else except on the next line. Issue: 9944
ishakhsuvarov
added
Release Line: 2.2
2.2.x
Reproduced on 2.1.x
The issue has been reproduced on latest 2.1 release
Reproduced on 2.2.x
The issue has been reproduced on latest 2.2 release
Reproduced on 2.3.x
The issue has been reproduced on latest 2.3 release
labels
Oct 23, 2017
magento-team
pushed a commit
that referenced
this pull request
Oct 26, 2017
magento-team
pushed a commit
that referenced
this pull request
Oct 26, 2017
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-82724 Allow coupon code with special charater to be applied to order in checkout #11710 - MAGETWO-82675 Add a health check to the NGINX configuration sample #11690 - MAGETWO-82562 Coupon codes not showing in invoice #11635 - MAGETWO-82535 Fixed ability to set field config from layout xml #11302 [backport 2.2] #11643 - MAGETWO-81146 Fixing #10275 keyboard submit of adminhtml suggest form. #11250 - MAGETWO-82761 [Backport 2.2-develop] Dashboard Fix Y Axis for range #11751 - MAGETWO-82748 Fix Notice: freePackageValue is undefined #11720 - MAGETWO-82747 [TASK] Updated user.ini according to Magento DevDocs #11734 - MAGETWO-82537 MAGETWO-81311: Check the length of the array before attempting to sli… #11637 - MAGETWO-81970 Add missing translations in Magento_UI #11440 - MAGETWO-81904 FIX #11022 in 2.2-develop: Filter Groups of search criteria parameter have not been included for further processing #11421 - MAGETWO-82179 Fix Filter Customer Report Review 2.2-develop [Backport] #11522
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Progress: accept
Release Line: 2.2
Reproduced on 2.1.x
The issue has been reproduced on latest 2.1 release
Reproduced on 2.2.x
The issue has been reproduced on latest 2.2 release
Reproduced on 2.3.x
The issue has been reproduced on latest 2.3 release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ce it. Slicing an array of one will create an empty result. Issue: 9944
Description
#9944
In the UI form element abstract.js, there is a case where the dataScope passed to the initConfig function may not have the string "data" appended to the name. In this case, performing a 'slice' on an array of 1 will create an empty result. In these cases, I have added a check to ensure that the array is at least greater than 1 before slicing, otherwise, use the result of splitting the scope variable.
In these cases you will always end of with something like:
["data_value"] or ["data_value", "data_value_two"]
Instead of a potential: [], which when used as the inputName would result in an empty input name attribute on the form element.
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist