mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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:
parent
f466722928
commit
4a6d2bbc00
@ -51,7 +51,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
|||||||
if ( $this->image )
|
if ( $this->image )
|
||||||
return true;
|
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 );
|
return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
|
||||||
|
|
||||||
// Set artificially high because GD uses uncompressed images in memory
|
// 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 )
|
if ( $this->image )
|
||||||
return true;
|
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 );
|
return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -3221,7 +3221,7 @@ function wp_load_image( $file ) {
|
|||||||
if ( is_numeric( $file ) )
|
if ( is_numeric( $file ) )
|
||||||
$file = get_attached_file( $file );
|
$file = get_attached_file( $file );
|
||||||
|
|
||||||
if ( ! file_exists( $file ) )
|
if ( ! is_file( $file ) )
|
||||||
return sprintf(__('File “%s” doesn’t exist?'), $file);
|
return sprintf(__('File “%s” doesn’t exist?'), $file);
|
||||||
|
|
||||||
if ( ! function_exists('imagecreatefromstring') )
|
if ( ! function_exists('imagecreatefromstring') )
|
||||||
|
Loading…
Reference in New Issue
Block a user