From 35eec2dd57fe5e40e97065980136cacb9be5b2c5 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 22 Jul 2013 17:01:00 +0000 Subject: [PATCH] Confirm we are dealing with an Imagick object. see #24539. git-svn-id: http://core.svn.wordpress.org/trunk@24765 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index f5f36a4ce9..466dc44971 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -19,7 +19,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { protected $image = null; // Imagick Object function __destruct() { - if ( $this->image ) { + if ( $this->image instanceof Imagick ) { // we don't need the original in memory anymore $this->image->clear(); $this->image->destroy(); @@ -113,7 +113,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * @return boolean|WP_Error True if loaded; WP_Error on failure. */ public function load() { - if ( $this->image ) + if ( $this->image instanceof Imagick ) return true; if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) ) @@ -124,6 +124,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { try { $this->image = new Imagick( $this->file ); + ob_start(); var_dump( $this->image instanceof Imagick ); error_log( ob_get_clean() ); if( ! $this->image->valid() ) return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);