Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#53680 closed defect (bug) (fixed)

Correct inline documentation about `IMAGETYPE_WEBP` and `IMG_WEBP`

Reported by: GaryJ Owned by: SergeyBiryukov
Priority: normal Milestone: 5.8.1
Component: Media Version:
Severity: minor Keywords: good-first-bug has-patch fixed-major
Cc: Focuses: docs

Description

From ticket:35725#comment:195:

The // WebP constants are only defined in PHP 7.1+. comment in the code suggests that both IMAGETYPE_WEBP and IMG_WEBP were defined in PHP 7.1.

According to https://www.php.net/manual/en/function.imagetypes.php and https://www.php.net/manual/en/image.constants.php, the IMG_WEBP constant was available at 7.0.10, so the current comment is misleading.

This inline comment should be updated to be accurate.

Attachments (1)

53680.patch (640 bytes ) - added by rtm909 5 years ago.

Download all attachments as: .zip

Change History (7)

#1 @desrosj
5 years ago

  • Reporter changed from desrosj to GaryJ

Changing the reporter to reflect who first noticed the issue.

#2 @SergeyBiryukov
5 years ago

Thanks for catching this! Looks like it should be two separate comments:

// IMAGETYPE_WEBP is only defined in PHP 7.1 or later.
if ( ! defined( 'IMAGETYPE_WEBP' ) ) {
	define( 'IMAGETYPE_WEBP', 18 );
}

// IMG_WEBP is only defined in PHP 7.0.10 or later.
if ( ! defined( 'IMG_WEBP' ) ) {
	define( 'IMG_WEBP', IMAGETYPE_WEBP ); // phpcs:ignore PHPCompatibility.Constants.NewConstants.imagetype_webpFound
}

@rtm909
5 years ago

#3 @rtm909
5 years ago

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 51474:

Docs: Correct a comment about WebP constants in wp-includes/compat.php.

Follow-up to [50810], [50814].

Props GaryJ, rtm909.
Fixes #53680.

#5 @SergeyBiryukov
5 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closedreopened

Reopening for 5.8.1 consideration.

#6 @desrosj
5 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 51508:

Docs: Correct a comment about WebP constants in wp-includes/compat.php.

Follow-up to [50810], [50814].

Props GaryJ, rtm909, SergeyBiryukov.
Merges [51474] to the 5.8 branch.
Fixes #53680.

Note: See TracTickets for help on using tickets.