From 427f0159cc83bf29b2ec4e6aaa3f52342241d0ac Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 17 Jul 2023 20:04:24 +0000 Subject: [PATCH] Media: Stop using and deprecate `set_imagick_time_limit()`. Seems it causes more problems than it solves. Follow-up to #52569 and [55404]. Props: dsar, antpb, audrasjb, SergeyBiryukov, hberberoglu, mtxz, densityapps, ekazda, matt_fw, soulseekah, mikeschroder, azaozz. Fixes: #58202. Built from https://develop.svn.wordpress.org/trunk@56250 git-svn-id: http://core.svn.wordpress.org/trunk@55762 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 10 ++++++---- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index feb19d3507..756fcce894 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -268,6 +268,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * This function, which is expected to be run before heavy image routines, resolves * point 1 above by aligning Imagick's timeout with PHP's timeout, assuming it is set. * + * However seems it introduces more problems than it fixes, + * see https://core.trac.wordpress.org/ticket/58202. + * * Note: * - Imagick resource exhaustion does not issue catchable exceptions (yet). * See https://github.com/Imagick/imagick/issues/333. @@ -275,10 +278,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * image operations within the time of the HTTP request. * * @since 6.2.0 + * @since 6.3.0 This method was deprecated. * * @return int|null The new limit on success, null on failure. */ public static function set_imagick_time_limit() { + _deprecated_function( __METHOD__, '6.3.0' ); + if ( ! defined( 'Imagick::RESOURCETYPE_TIME' ) ) { return null; } @@ -329,8 +335,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { return $this->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h ); } - self::set_imagick_time_limit(); - // Execute the resize. $thumb_result = $this->thumbnail_image( $dst_w, $dst_h ); if ( is_wp_error( $thumb_result ) ) { @@ -597,8 +601,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { $src_h -= $src_y; } - self::set_imagick_time_limit(); - try { $this->image->cropImage( $src_w, $src_h, $src_x, $src_y ); $this->image->setImagePage( $src_w, $src_h, 0, 0 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 8c066e7211..5ce99bcac2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-beta4-56249'; +$wp_version = '6.3-beta4-56250'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.