Ticket #17814: 17814.3.diff

File 17814.3.diff, 1.5 KB (added by DH-Shredder, 8 months ago)

Just check with is_file()

Line 
1diff --git wp-includes/class-wp-image-editor-gd.php wp-includes/class-wp-image-editor-gd.php
2index 94c2eec..36b9878 100644
3--- wp-includes/class-wp-image-editor-gd.php
4+++ wp-includes/class-wp-image-editor-gd.php
5@@ -51,7 +51,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
6                if ( $this->image )
7                        return true;
8 
9-               if ( ! file_exists( $this->file ) )
10+               if ( ! is_file( $this->file ) )
11                        return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
12 
13                // Set artificially high because GD uses uncompressed images in memory
14diff --git wp-includes/class-wp-image-editor-imagick.php wp-includes/class-wp-image-editor-imagick.php
15index 3e35775..5557be2 100644
16--- wp-includes/class-wp-image-editor-imagick.php
17+++ wp-includes/class-wp-image-editor-imagick.php
18@@ -52,7 +52,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
19                if ( $this->image )
20                        return true;
21 
22-               if ( ! file_exists( $this->file ) )
23+               if ( ! is_file( $this->file ) )
24                        return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
25 
26                try {
27diff --git wp-includes/deprecated.php wp-includes/deprecated.php
28index a9744e8..101bc10 100644
29--- wp-includes/deprecated.php
30+++ wp-includes/deprecated.php
31@@ -3221,7 +3221,7 @@ function wp_load_image( $file ) {
32        if ( is_numeric( $file ) )
33                $file = get_attached_file( $file );
34 
35-       if ( ! file_exists( $file ) )
36+       if ( ! is_file( $file ) )
37                return sprintf(__('File “%s” doesn’t exist?'), $file);
38 
39        if ( ! function_exists('imagecreatefromstring') )