Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20725

Double escaping of OPTGROUP labels in choose_from_menu_nested()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.6
    • Fix Version/s: None
    • Component/s: Libraries
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      In lib/weblib.php around line 1011, inside function choose_from_menu_nested(), there is the following:

      $output .= ' <optgroup label="'. s(format_string($section)) .'">'."\n";

      The double escaping of the $section string is causing optgroup labels to display HTML codes such as "&"

      To reproduce the issue, simply put this code in a test page:

      <?php
      require_once 'config.php';

      $options['One & two'][1] = 'One';
      $options['One & two'][2] = 'Two';
      print choose_from_menu_nested($options, 'number');
      ?>

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: