diff --git a/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php b/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php index 17be081dd13..9ec0bc91947 100644 --- a/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php +++ b/app/code/core/Mage/Eav/Model/Attribute/Data/Text.php @@ -37,7 +37,7 @@ public function extractValue(Zend_Controller_Request_Http $request) * Validate data * Return true or array of errors * - * @param array|string $value + * @param string|bool|null $value * @return bool|array */ public function validateValue($value) @@ -51,7 +51,7 @@ public function validateValue($value) $value = $this->getEntity()->getDataUsingMethod($attribute->getAttributeCode()); } - if ($attribute->getIsRequired() && strlen($value) == 0) { + if ($attribute->getIsRequired() && (string) $value === '') { $errors[] = Mage::helper('eav')->__('"%s" is a required value.', $label); } @@ -60,7 +60,7 @@ public function validateValue($value) } // validate length - $length = Mage::helper('core/string')->strlen(trim($value)); + $length = Mage::helper('core/string')->strlen(trim((string) $value)); $validateRules = $attribute->getValidateRules(); if (!empty($validateRules['min_text_length']) && $length < $validateRules['min_text_length']) {