WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/15/2014 04:28:24 AM (7 years ago)
Author:
wonderboymusic
Message:

Eliminate one of the uses of extract() in wp_handle_sideload().

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r28268 r28416  
    422422    if ( $test_type ) {
    423423        $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
    424 
    425         extract( $wp_filetype );
     424        $ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext'];
     425        $type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type'];
     426        $proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename'];
    426427
    427428        // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
    428         if ( $proper_filename )
     429        if ( $proper_filename ) {
    429430            $file['name'] = $proper_filename;
    430 
    431         if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
    432             return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ));
    433 
    434         if ( !$type )
     431        }
     432        if ( ( ! $type || ! $ext ) && ! current_user_can( 'unfiltered_upload' ) ) {
     433            return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ) );
     434        }
     435        if ( ! $type ) {
    435436            $type = $file['type'];
     437        }
    436438    }
    437439
Note: See TracChangeset for help on using the changeset viewer.