From 311f800907eac62180bdc6e13bac4b012dc3e8da Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Mon, 30 May 2016 02:14:30 +0000 Subject: [PATCH] Docs: Ensure hook and duplicate hook docs directly precede all instances of the `image_memory_limit` filter. Hook docs must directly precede hooks in order for the Code Reference parser to correctly identify them as such. Fixes #36968. Built from https://develop.svn.wordpress.org/trunk@37592 git-svn-id: http://core.svn.wordpress.org/trunk@37560 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-gd.php | 6 ++++-- wp-includes/class-wp-image-editor-imagick.php | 9 +++++++-- wp-includes/deprecated.php | 8 ++++++-- wp-includes/version.php | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-image-editor-gd.php b/wp-includes/class-wp-image-editor-gd.php index f41a1ed432..96e7bf1dba 100644 --- a/wp-includes/class-wp-image-editor-gd.php +++ b/wp-includes/class-wp-image-editor-gd.php @@ -104,8 +104,10 @@ class WP_Image_Editor_GD extends WP_Image_Editor { * @param int|string $limit Maximum memory limit to allocate for images. Default WP_MAX_MEMORY_LIMIT. * Accepts an integer (bytes), or a shorthand string notation, such as '256M'. */ - // Set artificially high because GD uses uncompressed images in memory - @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + $image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ); + + // Set artificially high because GD uses uncompressed images in memory. + @ini_set( 'memory_limit', $image_memory_limit ); $this->image = @imagecreatefromstring( file_get_contents( $this->file ) ); diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 3ab9359038..3d92d39096 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -138,8 +138,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file ); /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */ - // Even though Imagick uses less PHP memory than GD, set higher limit for users that have low PHP.ini limits - @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + $image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ); + + /* + * Even though Imagick uses less PHP memory than GD, set higher limit + * for users that have low PHP.ini limits. + */ + @ini_set( 'memory_limit', $image_memory_limit ); try { $this->image = new Imagick( $this->file ); diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index f3d3862cd3..fed5fd8cff 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -3175,8 +3175,12 @@ function wp_load_image( $file ) { if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); - // Set artificially high because GD uses uncompressed images in memory - @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */ + $image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ); + + // Set artificially high because GD uses uncompressed images in memory. + @ini_set( 'memory_limit', $image_memory_limit ); + $image = imagecreatefromstring( file_get_contents( $file ) ); if ( !is_resource( $image ) ) diff --git a/wp-includes/version.php b/wp-includes/version.php index 7b6110a60b..a0370f0ac8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37591'; +$wp_version = '4.6-alpha-37592'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.