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');
?>
Attachments
Issue Links
| This issue has a non-specific relationship to: | ||||
| MDL-21126 | Icon madness in Main Menu block |
|
|
|
Creating patch to fix the issue.
the quickfix for this is to remove the format_string function.
replace this:
$output .= ' <optgroup label="'. s(format_string($section)) .'">'."\n";
To:
$output .= ' <optgroup label="'. s($section) .'">'."\n";