WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/15/2014 04:30:32 AM (8 years ago)
Author:
wonderboymusic
Message:

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

See #22400.

File:
1 edited

Legend:

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

    r28416 r28417  
    285285    if ( $test_type ) {
    286286        $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
    287 
    288         extract( $wp_filetype );
     287        $ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext'];
     288        $type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type'];
     289        $proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename'];
    289290
    290291        // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
    291         if ( $proper_filename )
     292        if ( $proper_filename ) {
    292293            $file['name'] = $proper_filename;
    293 
    294         if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
    295             return call_user_func($upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ));
    296 
    297         if ( !$type )
     294        }
     295        if ( ( ! $type || !$ext ) && ! current_user_can( 'unfiltered_upload' ) ) {
     296            return call_user_func( $upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ) );
     297        }
     298        if ( ! $type ) {
    298299            $type = $file['type'];
     300        }
    299301    } else {
    300302        $type = '';
Note: See TracChangeset for help on using the changeset viewer.