magento/magento2 — pull request #62 by tim-reynolds-briteskies (2012-08-10 19:40:33+00:00)
Title: Validation change for Text type EAV attributes

The call on Mage_Eav_Model_Attribute_Data_Text:67 to empty returns true of a value of "0" is entered, as specified in the PHP spec. This prevents the entry of zero on the backend admin for fields. Zero should be a valid value, as it was in our case.

No unit tests were created, as no unit tests exist currently for the Eav module.

I originally changed the code to the more complex:
if ($attribute->getIsRequired() &&
(
(is_array($value) && empty($value)) ||
(is_string($value) && strlen(trim($value))==0)
)

However, I wasn't sure that would catch all cases. I was also unsure if an array or numeric value would ever pass into the validator. I felt the cast-less comparison against the primary issue input was the best solution.