In `_wp_handle_upload()`, if `test_upload` is set to `false` in the array of dangerous overrides that the function allows, the only thing that happens when an upload fails is more potential breakage.
`$test_uploaded_file` lets is know if `$file['tmp_name']` exists, which allows to exit with an error, instead of continuing to attempt to move the file. `$test_upload` override is now a noop. Fixes #28208. Built from https://develop.svn.wordpress.org/trunk@30076 git-svn-id: http://core.svn.wordpress.org/trunk@30076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
45afcde640
commit
ee97a47c61
|
@ -269,8 +269,6 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
|||
$test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true;
|
||||
$mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false;
|
||||
|
||||
$test_upload = isset( $overrides['test_upload'] ) ? $overrides['test_upload'] : true;
|
||||
|
||||
// A correct form post will pass this test.
|
||||
if ( $test_form && ( ! isset( $_POST['action'] ) || ( $_POST['action'] != $action ) ) ) {
|
||||
return call_user_func( $upload_error_handler, $file, __( 'Invalid form submission.' ) );
|
||||
|
@ -293,7 +291,7 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
|||
|
||||
// A properly uploaded file will pass this test. There should be no reason to override this one.
|
||||
$test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_file( $file['tmp_name'] );
|
||||
if ( $test_upload && ! $test_uploaded_file ) {
|
||||
if ( ! $test_uploaded_file ) {
|
||||
return call_user_func( $upload_error_handler, $file, __( 'Specified file failed upload test.' ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.1-alpha-30075';
|
||||
$wp_version = '4.1-alpha-30076';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue