Pass associative array to Sanitizer::validateAttributes

Bug: T255049
Change-Id: I68f122d5a3fa06b0434863cff73851a39dd10514
This commit is contained in:
C. Scott Ananian 2020-06-10 14:01:21 -04:00
parent 48b20d9b67
commit c281e5f423
2 changed files with 4 additions and 2 deletions

View file

@ -14,7 +14,7 @@
"license-name": "GPL-2.0-or-later", "license-name": "GPL-2.0-or-later",
"type": "parserhook", "type": "parserhook",
"requires": { "requires": {
"MediaWiki": ">= 1.33", "MediaWiki": ">= 1.34",
"platform": { "platform": {
"ability-shell": true "ability-shell": true
} }

View file

@ -121,7 +121,9 @@ class SyntaxHighlight {
$out = $result->getValue(); $out = $result->getValue();
// Allow certain HTML attributes // Allow certain HTML attributes
$htmlAttribs = Sanitizer::validateAttributes( $args, [ 'style', 'class', 'id', 'dir' ] ); $htmlAttribs = Sanitizer::validateAttributes(
$args, array_flip( [ 'style', 'class', 'id', 'dir' ] )
);
if ( !isset( $htmlAttribs['class'] ) ) { if ( !isset( $htmlAttribs['class'] ) ) {
$htmlAttribs['class'] = self::HIGHLIGHT_CSS_CLASS; $htmlAttribs['class'] = self::HIGHLIGHT_CSS_CLASS;
} else { } else {