Skip to content

Apostrophe in attribute option value in admin is not handled properly #12127

@erfanimani

Description

@erfanimani

Preconditions

  1. Magento 2.1 and 2.2
  2. Chrome 62

Steps to reproduce

  1. As an admin, go to Stores -> Attributes -> Products -> Manufacturer
  2. Add a new attribute option called "Nature's Way Supplements"
  3. Hit "Save and continue"
  4. Hit "Save and continue" again

Expected result

  1. In the admin, the attribute option value text input should say "Nature's Way Supplements"
  2. If you check the value in the database, it should be "Nature's Way Supplements"

Actual result

  1. The text input says: Nature's Way Supplements
  2. The database entry says: Nature's Way Supplements

After the first time of saving, the database looks alright, but the input value is wrong. This causes another save not to be idempotent. The bad escape causes side-effects, and this causes all sorts of issues — double escaping, imports not running because now the attribute options don't match up, and so on.

If that's not convincing, storing HTML escaped values int the database is clearly wrong — it should only be escaped if outputted to a web page, the database entry should be as close to the original user input as possible.

Couple other people are complaining about this on Stackexchange, i.e. https://magento.stackexchange.com/questions/198673/magento-2-cant-store-apostrophe-in-manufacturer-options

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: 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 developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions