From 6881e5f3657ff40532499a07ec608fc18f6ff3a0 Mon Sep 17 00:00:00 2001 From: Lee Worden Date: Sat, 23 Feb 2013 23:15:11 -0800 Subject: [PATCH 1/1] 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 --- includes/Setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Setup.php b/includes/Setup.php index 7f4d6342e9..0853df124f 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -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'; -- 2.20.1