Skip to content

Commit 85a3b87

Browse files
ENGCOM-5502: Fixed an issue where an attribute named length would break the use default value checkbox from saving #23725
2 parents 7d5f1b0 + 1de93cc commit 85a3b87

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/web/mage/utils/misc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ define([
231231
separator = separator || '-';
232232

233233
_.each(data, function (value, key) {
234-
if (_.isObject(value) && !value.length) {
234+
if (_.isObject(value) && !Array.isArray(value)) {
235235
this.filterFormData(value, suffix, separator);
236236
} else if (_.isString(key) && ~key.indexOf(suffix)) {
237237
data[key.split(separator)[0]] = value;

lib/web/mage/utils/objects.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,18 @@ define([
148148
separator = separator || '.';
149149
result = result || {};
150150

151-
_.each(data, function (node, name) {
151+
if (!data) {
152+
return result;
153+
}
154+
155+
// UnderscoreJS each breaks when an object has a length property so we use Object.keys
156+
_.each(Object.keys(data), function (name) {
157+
var node = data[name];
158+
159+
if ({}.toString.call(node) === '[object Function]') {
160+
return;
161+
}
162+
152163
if (parent) {
153164
name = parent + separator + name;
154165
}
@@ -436,3 +447,4 @@ define([
436447
}
437448
};
438449
});
450+

0 commit comments

Comments
 (0)