Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/code/Magento/Eav/Setup/EavSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ private function _validateAttributeData($data)
trim($attributeCode),
'StringLength',
['min' => $minLength, 'max' => $maxLength]
);
);

if (!$isAllowedLength) {
$errorMessage = __(
Expand All @@ -802,6 +802,18 @@ private function _validateAttributeData($data)

throw new LocalizedException($errorMessage);
}
$validatorAttrCode = new \Zend_Validate_Regex(
['pattern' => '/^[a-zA-Z\x{600}-\x{6FF}][a-zA-Z\x{600}-\x{6FF}_0-9]{0,60}$/u']
);
if (!$validatorAttrCode->isValid($attributeCode)) {
$this->messageManager->addErrorMessage(
__(
'Attribute code "%1" is invalid. Please use only letters (a-z or A-Z), ' .
'numbers (0-9) or underscore(_) in this field, first character should be a letter.',
$attributeCode
)
);
}

return true;
}
Expand Down