Remove gaps from $wgFileExtensions array

If $wgFileExtensions contains values that are in $wgFileBlacklist,
when Setup.php uses array_diff to remove them it leaves $wgFileExtensions
as an array with nonconsecutive integer indices.

When this array is encoded by the Xml class, for use in client-side
JavaScript, the nonconsecutive indices cause it to encode it as an
Object rather than Array.  This breaks the extension processing in
UploadWizard's JS code.  To fix this, use array_values to remove the
gaps in indices.

Bug: 44776
Change-Id: I4ef7f1de90a0384800722839f3fa3a581c63bac9
This commit is contained in:
Lee Worden 2013-02-23 23:15:11 -08:00 committed by Krinkle
parent d311beffec
commit 6881e5f365

View file

@ -337,7 +337,7 @@ if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
}
# Blacklisted file extensions shouldn't appear on the "allowed" list
$wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );
$wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
if ( $wgArticleCountMethod === null ) {
$wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';