Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#53680 closed defect (bug) (fixed)

Correct inline documentation about `IMAGETYPE_WEBP` and `IMG_WEBP`

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

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 3 years ago.

Download all attachments as: .zip

Change History (7)

#1 @desrosj
3 years ago

  • Reporter changed from desrosj to GaryJ

Changing the reporter to reflect who first noticed the issue.

#2 @SergeyBiryukov
3 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
3 years ago

#3 @rtm909
3 years ago

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

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
3 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 5.8.1 consideration.

#6 @desrosj
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

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.