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: http://core.svn.wordpress.org/trunk@22463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-08 02:02:03 +00:00
parent f466722928
commit 4a6d2bbc00
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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') )