WordPress.org

Make WordPress Core

Changeset 22904


Ignore:
Timestamp:
11/28/12 21:41:44 (17 months ago)
Author:
nacin
Message:

Explicitly check for version 2.2.0 or higher of the Imagick PHP module, to ensure we can call queryFormats() statically. props DH-Shredder, fixes #22308.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-image-editor-imagick.php

    r22864 r22904  
    3030     * Checks to see if current environment supports Imagick. 
    3131     * 
    32      * We require Imagick 2.1.1 or greater, based on whether the queryFormats() 
     32     * We require Imagick 2.2.0 or greater, based on whether the queryFormats() 
    3333     * method can be called statically. 
    3434     * 
     
    4242        // First, test Imagick's extension and classes. 
    4343        if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! class_exists( 'ImagickPixel' ) ) 
     44            return false; 
     45 
     46        if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) ) 
    4447            return false; 
    4548 
     
    6568 
    6669        // Now, test for deep requirements within Imagick. 
    67         if ( ! is_callable( 'Imagick', 'queryFormats' ) || 
    68              ! defined( 'imagick::COMPRESSION_JPEG' ) || 
    69              array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) { 
    70  
    71             return false; 
    72         } 
     70        if ( ! defined( 'imagick::COMPRESSION_JPEG' ) ) 
     71            return false; 
     72 
     73        if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) 
     74            return false; 
    7375 
    7476        return true; 
Note: See TracChangeset for help on using the changeset viewer.