Php Message Php Fatal Error Uncaught Typeerror

[Solved] Php Message Php Fatal Error Uncaught Typeerror | Vb - Code Explorer | yomemimo.com
Question : PHP message: PHP Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Eav\Model\Attribute\Data\Text::validateLength() must be of the type string, null given

Answered by : brave-batfish-z5bvsz2162wu

public function validateValue($value)
{ $errors = []; $attribute = $this->getAttribute(); if ($value === false) { // try to load original value and validate it $value = $this->getEntity()->getDataUsingMethod($attribute->getAttributeCode()); } if (!$attribute->getIsRequired() && empty($value)) { return true; } if (empty($value) && $value !== '0' && $attribute->getDefaultValue() === null) { $label = __($attribute->getStoreLabel()); $errors[] = __('"%1" is a required value.', $label); } $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/validatelog.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info($attribute->getName()); $validateLengthResult = $this->validateLength($attribute, $value); $errors = array_merge($errors, $validateLengthResult); $validateInputRuleResult = $this->validateInputRule($value); $errors = array_merge($errors, $validateInputRuleResult); if (count($errors) == 0) { return true; } return $errors;
}

Source : https://magento.stackexchange.com/questions/276254/magento-2-php-fatal-error-when-saving-custom-attribute-to-customers | Last Update : Sat, 09 May 20

Answers related to php message php fatal error uncaught typeerror argument 2 passed to magentoeavmodelattributedatatext validatelength must be of the type string null given

Code Explorer Popular Question For Vb