Make WordPress Core

Ticket #48074: 48074-src-Remove-work-arounds-for-IMAGETYPE_ICO.patch

File 48074-src-Remove-work-arounds-for-IMAGETYPE_ICO.patch, 1.1 KB (added by jrf, 5 years ago)

The IMAGETYPE_ICO constant was itroduced in PHP 5.3, so no longer needs a work-around. See: https://www.php.net/manual/en/image.constants.php

  • src/wp-admin/includes/image.php

    From f08abed85195b4a6884b6b7747083b562982a87e Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Sat, 27 Jul 2019 04:30:57 +0200
    Subject: [PATCH] [src] Remove work-arounds for IMAGETYPE_ICO
    
    ---
     src/wp-admin/includes/image.php | 7 +------
     1 file changed, 1 insertion(+), 6 deletions(-)
    
    diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php
    index bcdc2411f0..aa905254da 100644
    a b function file_is_valid_image( $path ) { 
    795795 * @return bool True if suitable, false if not suitable.
    796796 */
    797797function file_is_displayable_image( $path ) {
    798         $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
    799 
    800         // IMAGETYPE_ICO is only defined in PHP 5.3+.
    801         if ( defined( 'IMAGETYPE_ICO' ) ) {
    802                 $displayable_image_types[] = IMAGETYPE_ICO;
    803         }
     798        $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_ICO );
    804799
    805800        $info = @getimagesize( $path );
    806801        if ( empty( $info ) ) {