/**
  * Validate attribute value for attributes with source models
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $attrValue
  * @return array|bool
  */
 protected function _validateAttributeWithSource(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $attrValue)
 {
     $errors = array();
     // validate attributes with source models
     if (null !== $attrValue && $attribute->getSourceModel()) {
         if ('multiselect' !== $attribute->getFrontendInput() && is_array($attrValue)) {
             return array('Invalid value type for ' . $attribute->getAttributeCode());
         }
         $possibleValues = $attribute->getSource()->getAllOptions(false);
         foreach ((array) $attrValue as $value) {
             if (is_scalar($value)) {
                 $value = (string) $value;
                 $isValid = false;
                 foreach ($possibleValues as $optionData) {
                     // comparison without types check is performed only when both values are numeric
                     $useStrictMode = !(is_numeric($value) && is_numeric($optionData['value']));
                     $isValid = $useStrictMode ? $value === $optionData['value'] : $value == $optionData['value'];
                     if ($isValid) {
                         break;
                     }
                 }
                 if (!$isValid) {
                     $errors[] = 'Invalid value "' . $value . '" for ' . $attribute->getAttributeCode();
                 }
             } else {
                 $errors[] = 'Invalid value type for ' . $attribute->getAttributeCode();
             }
         }
     }
     return $errors ? $errors : true;
 }