Author: michaeldaly
Description:
If one enters a heading in Mediawiki:Sidebar with an embedded blank, the resulting HTML is not valid.
Example:
Mediawiki:Sidebar contains:
- recent changes
- recentchanges-url|recentchanges
Output is:
<div class='portlet' id='p-recent changes'>
The blank in the id is not valid.
At a minimum, in various /skins/skinname.php files, the second line of the following code should be changed from:
<?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> <div class='portlet' id='p-<?php echo htmlspecialchars($bar); ?>'>
to:
<?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> <div class='portlet' id='p-<?php echo str_replace( ' ', '_', htmlspecialchars($bar) ); ?>'>
It may be necessary, in general, to strip out or convert other invalid characters/symbols in the heading string.
Note if this editing is done in /includes/Skin.php (where the data is constructed), it will result in the modified text being displayed on the wiki page. Modifying it in the /skins/skinname.php file(s) preserves the display and only prevents the invalid HTML from being generated.
Version: unspecified
Severity: minor