From ee97a47c61d0b0030f26217abd900e09d718aecd Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 28 Oct 2014 21:17:22 +0000 Subject: [PATCH] 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 --- wp-admin/includes/file.php | 4 +--- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 18c1fc9a2f..964fc4ad0b 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -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.' ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 4173838582..55c5f0089d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.