In WP_Image_Editor / wp_load_image(), use is_file() rather than file_exists() so we do not accidentally load a directory.
props benkulbertis, DH-Shredder, scribu. fixes #17814. git-svn-id: https://develop.svn.wordpress.org/trunk@22463 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e2f0bcf510
commit
5395736356
@ -51,7 +51,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
if ( $this->image )
|
||||
return true;
|
||||
|
||||
if ( ! file_exists( $this->file ) )
|
||||
if ( ! is_file( $this->file ) )
|
||||
return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
|
||||
|
||||
// Set artificially high because GD uses uncompressed images in memory
|
||||
|
@ -52,7 +52,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||
if ( $this->image )
|
||||
return true;
|
||||
|
||||
if ( ! file_exists( $this->file ) )
|
||||
if ( ! is_file( $this->file ) )
|
||||
return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
|
||||
|
||||
try {
|
||||
|
@ -3221,7 +3221,7 @@ function wp_load_image( $file ) {
|
||||
if ( is_numeric( $file ) )
|
||||
$file = get_attached_file( $file );
|
||||
|
||||
if ( ! file_exists( $file ) )
|
||||
if ( ! is_file( $file ) )
|
||||
return sprintf(__('File “%s” doesn’t exist?'), $file);
|
||||
|
||||
if ( ! function_exists('imagecreatefromstring') )
|
||||
|
Loading…
Reference in New Issue
Block a user