WordPress.org

Make WordPress Core

Ticket #22543: 22543-4.diff

File 22543-4.diff, 753 bytes (added by markoheijnen, 6 years ago)

Add check if class exists and check if setIteratorIndex is callable when the mime_type is for GIF or not given

  • wp-includes/class-wp-image-editor-imagick.php

     
    3838         * @return boolean
    3939         */
    4040        public static function test( $args = array() ) {
    41                 if ( ! extension_loaded( 'imagick' ) || ! is_callable( 'Imagick', 'queryFormats' ) )
     41                if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! is_callable( 'Imagick', 'queryFormats' ) )
    4242                        return false;
    4343
     44                if( ( ! isset( $args['mime_type'] ) || $args['mime_type'] == 'image/gif' )  && ! is_callable( $this->image, 'setIteratorIndex' ) )
     45                        return false;
     46
    4447                return true;
    4548        }
    4649