Media: Correct the fallback value passed to the `$mimes` parameter of `wp_check_filetype_and_ext()` from `_wp_handle_upload()`, and update corresponding documentation.
Previously when the `mimes` element was not specified in the overrides array passed to `_wp_handle_upload()` it resulted in boolean false being passed to this parameter, which is incorrect. The fallback value should be `null`. Props platonkristinin, pkbhatt Fixes #58349 Built from https://develop.svn.wordpress.org/trunk@55872 git-svn-id: http://core.svn.wordpress.org/trunk@55384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ffd2a5bb95
commit
f3b93e6b3a
|
@ -890,7 +890,7 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
|||
|
||||
// If you override this, you must provide $ext and $type!!
|
||||
$test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true;
|
||||
$mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false;
|
||||
$mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : null;
|
||||
|
||||
// A correct form post will pass this test.
|
||||
if ( $test_form && ( ! isset( $_POST['action'] ) || $_POST['action'] !== $action ) ) {
|
||||
|
|
|
@ -3012,9 +3012,9 @@ function wp_get_default_extension_for_mime_type( $mime_type ) {
|
|||
*
|
||||
* @since 2.0.4
|
||||
*
|
||||
* @param string $filename File name or path.
|
||||
* @param string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex.
|
||||
* Defaults to the result of get_allowed_mime_types().
|
||||
* @param string $filename File name or path.
|
||||
* @param string[]|null $mimes Optional. Array of allowed mime types keyed by their file extension regex.
|
||||
* Defaults to the result of get_allowed_mime_types().
|
||||
* @return array {
|
||||
* Values for the extension and mime type.
|
||||
*
|
||||
|
@ -3053,11 +3053,11 @@ function wp_check_filetype( $filename, $mimes = null ) {
|
|||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $file Full path to the file.
|
||||
* @param string $filename The name of the file (may differ from $file due to $file being
|
||||
* in a tmp directory).
|
||||
* @param string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex.
|
||||
* Defaults to the result of get_allowed_mime_types().
|
||||
* @param string $file Full path to the file.
|
||||
* @param string $filename The name of the file (may differ from $file due to $file being
|
||||
* in a tmp directory).
|
||||
* @param string[]|null $mimes Optional. Array of allowed mime types keyed by their file extension regex.
|
||||
* Defaults to the result of get_allowed_mime_types().
|
||||
* @return array {
|
||||
* Values for the extension, mime type, and corrected filename.
|
||||
*
|
||||
|
@ -3239,18 +3239,19 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
|||
* @since 3.0.0
|
||||
* @since 5.1.0 The $real_mime parameter was added.
|
||||
*
|
||||
* @param array $wp_check_filetype_and_ext {
|
||||
* @param array $wp_check_filetype_and_ext {
|
||||
* Values for the extension, mime type, and corrected filename.
|
||||
*
|
||||
* @type string|false $ext File extension, or false if the file doesn't match a mime type.
|
||||
* @type string|false $type File mime type, or false if the file doesn't match a mime type.
|
||||
* @type string|false $proper_filename File name with its correct extension, or false if it cannot be determined.
|
||||
* }
|
||||
* @param string $file Full path to the file.
|
||||
* @param string $filename The name of the file (may differ from $file due to
|
||||
* $file being in a tmp directory).
|
||||
* @param string[] $mimes Array of mime types keyed by their file extension regex.
|
||||
* @param string|false $real_mime The actual mime type or false if the type cannot be determined.
|
||||
* @param string $file Full path to the file.
|
||||
* @param string $filename The name of the file (may differ from $file due to
|
||||
* $file being in a tmp directory).
|
||||
* @param string[]|null $mimes Array of mime types keyed by their file extension regex, or null if
|
||||
* none were provided.
|
||||
* @param string|false $real_mime The actual mime type or false if the type cannot be determined.
|
||||
*/
|
||||
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55871';
|
||||
$wp_version = '6.3-alpha-55872';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue