From 00de7b5f4db329d16bff33ca497f288ebe369cd2 Mon Sep 17 00:00:00 2001 From: Ng Kiat Siong Date: Wed, 22 Jan 2025 11:37:51 +0800 Subject: [PATCH] Fixed null deprecation in Mage_Eav_Model_Attribute_Data_Text (#4500) * 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 --- app/code/core/Mage/Eav/Model/Attribute/Data/Text.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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']) {