When a select list contains a value with an apostrophe it is unable to be recognized as the current selected value on when the form is loaded. This is due to Drupal's use of the ENT_QUOTES flag when encoding html entities with htmlentities. A quick fix for this is adding a call to html_entity_decode when the keys are being compared in the select_or_other_multi_array_key_exists function.

So the following code

  if (array_key_exists($needle), $haystack)) {
    return TRUE;
  }

becomes

  if (array_key_exists(html_entity_decode($needle, ENT_QUOTES), $haystack)) {
    return TRUE;
  }

Comments

cmaddalozzo’s picture

Please see attached fix.

cmaddalozzo’s picture

Status: Active » Needs review
haydeniv’s picture

Status: Needs review » Fixed

Committed to head commit a3707c9.
Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit a3707c9 on 7.x-2.x, 7.x-3.x, 8.x-3.x by haydeniv:
    Issue #1721522 by cmaddalozzo: Apostrophe encoding.