Make WordPress Core


Ignore:
Timestamp:
12/04/2020 09:39:30 PM (4 years ago)
Author:
iandunn
Message:

Media: Return WP_Error when cropping with bad input to avoid fatal.

This avoids an error on PHP 8 caused by calling wp_imagecreatetruecolor() with inputs that aren't numeric, or are less than 0.

Props hellofromtonya, Boniu91, metalandcoffee, SergeyBiryukov.
Fixes #51937.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r49613 r49751  
    35063506 * @param int $width  Image width in pixels.
    35073507 * @param int $height Image height in pixels.
    3508  * @return resource|GdImage The GD image resource or GdImage instance.
     3508 * @return resource|GdImage|false The GD image resource or GdImage instance on success. False on failure.
    35093509 */
    35103510function wp_imagecreatetruecolor( $width, $height ) {
Note: See TracChangeset for help on using the changeset viewer.