Make WordPress Core

Ticket #52826: trac-52826.diff

File trac-52826.diff, 1.3 KB (added by terriann, 5 years ago)

Do not pass the second parameter unless it is explicitly provided when calling wp_getimagesize

  • wp-includes/media.php

     
    49794979 * @param array  $imageinfo Extended image information, passed by reference.
    49804980 * @return array|false Array of image information or false on failure.
    49814981 */
    4982 function wp_getimagesize( $filename, &$imageinfo = array() ) {
     4982function wp_getimagesize( $filename, &$imageinfo = null ) {
    49834983        if (
    49844984                // Skip when running unit tests.
    49854985                ! defined( 'WP_RUN_CORE_TESTS' )
     
    49874987                // Return without silencing errors when in debug mode.
    49884988                defined( 'WP_DEBUG' ) && WP_DEBUG
    49894989        ) {
    4990                 return getimagesize( $filename, $imageinfo );
     4990                if ( ! is_null( $imageinfo ) ) {
     4991                        return getimagesize( $filename, $imageinfo );
     4992                } else {
     4993                        return getimagesize( $filename );
     4994                }
    49914995        }
    49924996
    49934997        /*
     
    49985002         * even when it's able to provide image size information.
    49995003         *
    50005004         * See https://core.trac.wordpress.org/ticket/42480
    5001          *
    5002          * phpcs:ignore WordPress.PHP.NoSilencedErrors
    50035005         */
    5004         return @getimagesize( $filename, $imageinfo );
     5006        if ( ! is_null( $imageinfo ) ) {
     5007                // phpcs:ignore WordPress.PHP.NoSilencedErrors
     5008                return @getimagesize( $filename, $imageinfo );
     5009        } else {
     5010                // phpcs:ignore WordPress.PHP.NoSilencedErrors
     5011                return @getimagesize( $filename );
     5012        }
    50055013}