Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revisão 36987)
+++ src/wp-includes/functions.php	(cópia de trabalho)
@@ -2195,18 +2195,7 @@
 	 * @param array $ext2type Multi-dimensional array with extensions for a default set
 	 *                        of file types.
 	 */
-	$ext2type = apply_filters( 'ext2type', array(
-		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
-		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
-		'video'       => array( '3g2',  '3gp', '3gpp', 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
-		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd', 'xcf' ),
-		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
-		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
-		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
-		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
-		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
-	) );
-
+	$ext2type = wp_get_ext_types();
 	foreach ( $ext2type as $type => $exts )
 		if ( in_array( $ext, $exts ) )
 			return $type;
@@ -2451,7 +2440,28 @@
 	'pages' => 'application/vnd.apple.pages',
 	) );
 }
+
 /**
+ * Retrieve list of common extensions file
+ *
+ * @ticket 35987
+ * @return array Array of extensions types keyed by the type of file
+ */
+function wp_get_ext_types() {
+	return apply_filters( 'ext2type', array(
+		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
+		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
+		'video'       => array( '3g2',  '3gp', '3gpp', 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
+		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd', 'xcf' ),
+		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
+		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
+		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
+		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
+		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
+	) );
+}
+
+/**
  * Retrieve list of allowed mime types and file extensions.
  *
  * @since 2.8.6
Index: tests/phpunit/tests/functions.php
===================================================================
--- tests/phpunit/tests/functions.php	(revisão 36987)
+++ tests/phpunit/tests/functions.php	(cópia de trabalho)
@@ -813,4 +813,46 @@
 			array( '2016-03-02T19:13:00', '16-03-02 19:13' )
 		);
 	}
+
+	/**
+	 * @ticket 35987
+	 */
+	function test_wp_get_ext_types() {
+		$extensionList = wp_get_ext_types();
+
+		$this->assertInternalType( 'array', $extensionList);
+		$this->assertNotEmpty($extensionList);
+
+		add_filter( 'ext2type', '__return_empty_array' );
+		$mimes = wp_get_ext_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertEmpty( $mimes );
+
+		remove_filter( 'ext2type', '__return_empty_array' );
+		$mimes = wp_get_ext_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+
+		$this->assertTrue(in_array('jpg', $extensionList['image']));
+		$this->assertTrue(in_array('aiff', $extensionList['audio']));
+		$this->assertTrue(in_array('php', $extensionList['code']));
+		$this->assertTrue(in_array('xls', $extensionList['spreadsheet']));
+		$this->assertTrue(in_array('doc', $extensionList['document']));
+		$this->assertTrue(in_array('txt', $extensionList['text']));
+	}
+
+	/**
+	 * @ticket 35987
+	 */
+	function test_wp_ext2type() {
+		$extensions = wp_get_ext_types();
+
+		foreach ($extensions as $type => $extensionList) {
+			foreach ($extensionList as $extension) {
+				$this->assertEquals($type, wp_ext2type($extension));
+				$this->assertEquals($type, wp_ext2type(strtoupper($extension)));
+			}
+		}
+		$this->assertNull(wp_ext2type('unknown_format'));
+	}
 }
