Skip to content

Product Attribute Repository do not respect attribute_code max length #29017

Closed
@drc0

Description

@drc0

Preconditions (*)

on magento 2.4 a product attribute code with attribute_code of value A_12345678_9123_4567_890a_BCDEF123456 is saved through the admin ui but not from the repository. Here Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH should be respected.

Steps to reproduce (*)

Here is a code example:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$ar = $objectManager->create('Magento\Catalog\Api\ProductAttributeRepositoryInterface');
$attf = $objectManager->create('\Magento\Catalog\Api\Data\ProductAttributeInterfaceFactory');
$a = $attf->create();
$a->setData(['attribute_code' => 'A_12345678_9123_4567_890a_BCDEF123456','frontend_label' => 'a test', 'frontend_input' => 'text']);
$ar->save($a);
    Magento/Framework/Exception/InputException with message 'Invalid value of "A_12345678_9123_4567_890a_BCDEF123456" provided for the attribute_code field.'


Expected result (*)

  1. attribute is saved

Actual result (*)

  1. validator exception

Addiotional information

Issue is reproducible via WebApi
#29017Main


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: CatalogFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions