Make WordPress Core

Ticket #39552: 39552.2.patch

File 39552.2.patch, 813 bytes (added by freakpants, 8 years ago)
  • wp-includes/functions.php

     
    23732373                } else {
    23742374                        $mime = false;
    23752375                }
     2376                if( ( $mime === 'application/octet-stream' || $mime === false ) && function_exists ( 'finfo_file' ) ){
     2377                        /* if the mime type is false or octet stream, its possible we are dealing with an image file not supported by PHP Constants (this applies at least to svg, but might apply to other file types)
     2378                        to fix this, use finfo to determine the mimetype instead
     2379                        */
     2380                        $finfo = finfo_open( FILEINFO_MIME_TYPE );
     2381                        $mime = finfo_file( $finfo, $file );
     2382                        finfo_close( $finfo );
     2383                }
    23762384        } catch ( Exception $e ) {
    23772385                $mime = false;
    23782386        }