Skip to content

Commit

Permalink
Fixed null deprecation in Mage_Eav_Model_Attribute_Data_Text (#4500)
Browse files Browse the repository at this point in the history
* Fixed null deprecation in Mage_Eav_Model_Attribute_Data_Text

* Update app/code/core/Mage/Eav/Model/Attribute/Data/Text.php

---------

Co-authored-by: Sven Reichel <[email protected]>
  • Loading branch information
kiatng and sreichel authored Jan 22, 2025
1 parent 031de28 commit 00de7b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/code/core/Mage/Eav/Model/Attribute/Data/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}

Expand All @@ -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']) {
Expand Down

0 comments on commit 00de7b5

Please sign in to comment.