Opened 8 months ago
Closed 8 months ago
#64557 closed defect (bug) (fixed)
WP_Customize_Media_Control default webp
| Reported by: | buutqn | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0 |
| Component: | Customize | Version: | 6.9 |
| Severity: | minor | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
Class WP_Customize_Media_Control, in function to_json, ignores different number of characters for extensions, ignoring those extensions that has 4 characters.
https://github.com/WordPress/wordpress-develop/blob/6.9/src/wp-includes/customize/class-wp-customize-media-control.php#L95-L96
Line 95 will not return "webp" or "avif":
$ext = substr( $this->setting->default, -3 );
Change History (7)
This ticket was mentioned in PR #10803 on WordPress/wordpress-develop by buutqn.
8 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
8 months ago
Should we simplify?
$ext = pathinfo( $this->setting->default, PATHINFO_EXTENSION );
#3
@
8 months ago
- Milestone Awaiting Review → 7.0
- Owner set to
- Status new → reviewing
Good catch. This certainly can be made more robust.
The use of substr() was introduced in r30309 (4175d8a). But the actual issue was introduced in r50810 (for #35725) to add WebP support and similarly in r57524 (for #51228) to add AVIF support, as these two file formats use 4-character file file extensions.
@westonruter commented on PR #10803:
8 months ago
#4
Note: In the future, it would be preferable to open a pull request to target trunk rather than the current release branch.
This ticket was mentioned in PR #10842 on WordPress/wordpress-develop by @westonruter.
8 months ago
#5
- Keywords has-unit-tests added
@westonruter commented on PR #10803:
8 months ago
#6
Closing in favor of https://github.com/WordPress/wordpress-develop/pull/10842
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Fix WP_Customize_Media_Control::to_json() extension validation.
Trac ticket: #64557