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.

git-svn-id: http://core.svn.wordpress.org/trunk@22904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-28 21:41:44 +00:00
parent 7322ea40d6
commit 01e11b6b23
1 changed files with 8 additions and 6 deletions

View File

@ -29,7 +29,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
/**
* Checks to see if current environment supports Imagick.
*
* We require Imagick 2.1.1 or greater, based on whether the queryFormats()
* We require Imagick 2.2.0 or greater, based on whether the queryFormats()
* method can be called statically.
*
* @since 3.5.0
@ -43,6 +43,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! class_exists( 'ImagickPixel' ) )
return false;
if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
return false;
$required_methods = array(
'clear',
'destroy',
@ -64,12 +67,11 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
);
// Now, test for deep requirements within Imagick.
if ( ! is_callable( 'Imagick', 'queryFormats' ) ||
! defined( 'imagick::COMPRESSION_JPEG' ) ||
array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) {
if ( ! defined( 'imagick::COMPRESSION_JPEG' ) )
return false;
if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) )
return false;
}
return true;
}