PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | classes/Optimization/File.php +19 -3 2.3.3 → trunk View file →
@@ -658,11 +658,27 @@
658 658 }
659 659
660 660 if ( $is_nextgen_request ) {
661 661 $destination_path = $this->get_path_to_nextgen( $args['convert'] );
662 - $this->path = $destination_path;
663 - $this->file_type = null;
664 - $this->editor = null;
662 +
663 + /*
664 + * get_path_to_nextgen() returns false when the file is not an image, or when it
665 + * already is in a next-gen format. Passing that along would hand an empty path to
666 + * the filesystem, which throws an uncaught ValueError on PHP 8 and kills the
667 + * background process mid-batch, leaving its lock behind and stalling the queue.
668 + */
669 + if ( empty( $destination_path ) ) {
670 + $this->filesystem->delete( $temp_file );
671 +
672 + return new \WP_Error(
673 + 'no_nextgen_destination',
674 + __( 'Could not determine the destination path for the next-gen file.', 'imagify' )
675 + );
676 + }
677 +
678 + $this->path = $destination_path;
679 + $this->file_type = null;
680 + $this->editor = null;
665 681 } else {
666 682 $destination_path = $this->path;
667 683 }
668 684