Skip to content

Product attribute option manager's existing option check fails #18246

@jarnooravainen

Description

@jarnooravainen

Preconditions

  1. Magento Commerce 2.2.5 (version of module-catalog is 102.0.5)

Steps to reproduce

  1. Add attribute options by calling \Magento\Catalog\Model\Product\Attribute\OptionManagement::add
  2. Add attribute option that has admin scope value '01'.
  3. Add another option for same attribute that has admin scope value '1'.

Expected result

  1. Both options can be found from table eav_attribute_option_value.

Actual result

  1. Only option with value '01' exists in DB.

Origin of the issue

if (in_array($option->getLabel(), $currentOptions)) {

In_Array comparison fails due to fact that comparison is not done "strictly".

Suggested fix

if (in_array((string)$option->getLabel(), $currentOptions, true)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedReproduced on 2.2.xThe issue has been reproduced on latest 2.2 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions