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:
parent
7322ea40d6
commit
01e11b6b23
|
@ -29,7 +29,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
/**
|
/**
|
||||||
* Checks to see if current environment supports Imagick.
|
* 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.
|
* method can be called statically.
|
||||||
*
|
*
|
||||||
* @since 3.5.0
|
* @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' ) )
|
if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! class_exists( 'ImagickPixel' ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
$required_methods = array(
|
$required_methods = array(
|
||||||
'clear',
|
'clear',
|
||||||
'destroy',
|
'destroy',
|
||||||
|
@ -64,12 +67,11 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Now, test for deep requirements within Imagick.
|
// Now, test for deep requirements within Imagick.
|
||||||
if ( ! is_callable( 'Imagick', 'queryFormats' ) ||
|
if ( ! defined( 'imagick::COMPRESSION_JPEG' ) )
|
||||||
! defined( 'imagick::COMPRESSION_JPEG' ) ||
|
return false;
|
||||||
array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) {
|
|
||||||
|
if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue