cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: EAV Multiline validate not correct when maxLength in checkout

BUG: EAV Multiline validate not correct when maxLength in checkout

Version 1.9.2.4

 

Reproduce:

define maxLength 38 for the multiline-attribute "street" and you have two lines e.g. "street" and "street2".

 

validate_rules = a:2:{s:15:"max_text_length";i:38;s:15:"min_text_length";i:1;}

multiline_count  = 2

 

In the account create an address with

street = some string with 38 chars

and

street2=some string with 38 chars

 

Then in the checkout select this address and proceed. 

=> This leeds to an validation error: "Street cannot have more then 38 chars"

 

The reason is, that the function validateRule in class Mage_Eav_Model_Attribute_Data_Multiline validates the char-length of both multiline fields anginst the defined 38 maxLength.

 

FIX:

change

if (!is_array($value)) {
$value = array($value);
}

to:

if (!is_array($value)) {
$value = explode("\n", ($value));
}

in magento2 it was fixed already:

https://github.com/magento/magento2/blob/develop/app/code/Magento/Eav/Model/Attribute/Data/Multiline...