diff --git a/vendor/magento/module-customer/etc/di.xml b/vendor/magento/module-customer/etc/di.xml index 96fd4b86be702..1792399fb2cb3 100644 --- a/vendor/magento/module-customer/etc/di.xml +++ b/vendor/magento/module-customer/etc/di.xml @@ -578,6 +578,7 @@ store_id group_id dob + rp_token country_id @@ -585,6 +586,15 @@ + + + + + email + + + + + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData { @@ -21,20 +26,28 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData protected $_string; /** - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Locale\ResolverInterface $localeResolver - * @param \Magento\Framework\Stdlib\StringUtils $stringHelper + * @var array + */ + private $allowDiacriticsForAttributes; + + /** + * @param TimezoneInterface $localeDate + * @param LoggerInterface $logger + * @param ResolverInterface $localeResolver + * @param StringUtils $stringHelper + * @param array $allowDiacriticsForAttributes * @codeCoverageIgnore */ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Locale\ResolverInterface $localeResolver, - \Magento\Framework\Stdlib\StringUtils $stringHelper + \Magento\Framework\Stdlib\StringUtils $stringHelper, + array $allowDiacriticsForAttributes = [] ) { parent::__construct($localeDate, $logger, $localeResolver); $this->_string = $stringHelper; + $this->allowDiacriticsForAttributes = $allowDiacriticsForAttributes; } /** @@ -79,8 +92,14 @@ public function validateValue($value) return $errors; } - // if string with diacritics encode it. - $value = $this->encodeDiacritics($value); + if (isset($this->allowDiacriticsForAttributes[$attribute->getEntityType()->getEntityTypeCode()]) + && in_array( + $attribute->getAttributeCode(), + $this->allowDiacriticsForAttributes[$attribute->getEntityType()->getEntityTypeCode()] + )) { + // if string with diacritics encode it. + $value = $this->encodeDiacritics($value); + } $validateLengthResult = $this->validateLength($attribute, $value); $errors = array_merge($errors, $validateLengthResult);