Make WordPress Core

Ticket #42480: 42480.2.diff

File 42480.2.diff, 2.8 KB (added by joemcgill, 7 years ago)
  • src/wp-admin/includes/image.php

    diff --git src/wp-admin/includes/image.php src/wp-admin/includes/image.php
    index 4b66a5d36f..0a2be45278 100644
    function wp_read_image_metadata( $file ) { 
    357357                return false;
    358358        }
    359359
    360         list( , , $sourceImageType ) = getimagesize( $file );
     360        list( , , $sourceImageType ) = @getimagesize( $file );
    361361
    362362        /*
    363363         * EXIF contains a bunch of data we'll probably never need formatted in ways
    function wp_read_image_metadata( $file ) { 
    389389                getimagesize( $file, $info );
    390390
    391391                if ( ! empty( $info['APP13'] ) ) {
    392                         $iptc = iptcparse( $info['APP13'] );
     392                        $iptc = @iptcparse( $info['APP13'] );
    393393
    394394                        // Headline, "A brief synopsis of the caption."
    395395                        if ( ! empty( $iptc['2#105'][0] ) ) {
  • src/wp-admin/includes/media.php

    diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
    index 03e949f16f..42584ee5c0 100644
    function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid 
    368368                        $content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
    369369                }
    370370
    371                 // Use image exif/iptc data for title and caption defaults if possible.
    372         } elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = @wp_read_image_metadata( $file ) ) {
     371        // Use image exif/iptc data for title and caption defaults if possible.
     372        } elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = wp_read_image_metadata( $file ) ) {
    373373                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
    374374                        $title = $image_meta['title'];
    375375                }
    function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data 
    437437        $content = '';
    438438
    439439        // Use image exif/iptc data for title and caption defaults if possible.
    440         if ( $image_meta = @wp_read_image_metadata( $file ) ) {
     440        if ( $image_meta = wp_read_image_metadata( $file ) ) {
    441441                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
    442442                        $title = $image_meta['title'];
    443443                }
  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    index 528a6ce0c6..30ddafc982 100644
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    123123                $file = $file['file'];
    124124
    125125                // use image exif/iptc data for title and caption defaults if possible
    126                 $image_meta = @wp_read_image_metadata( $file );
     126                $image_meta = wp_read_image_metadata( $file );
    127127
    128128                if ( ! empty( $image_meta ) ) {
    129129                        if ( empty( $request['title'] ) && trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {