Opened 6 weeks ago
Closed 5 weeks ago
#64557 closed defect (bug) (fixed)
WP_Customize_Media_Control default webp
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | minor | Version: | 6.9 |
| Component: | Customize | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
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.
6 weeks ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
6 weeks ago
Should we simplify?
$ext = pathinfo( $this->setting->default, PATHINFO_EXTENSION );
#3
@
6 weeks ago
- Milestone changed from Awaiting Review to 7.0
- Owner set to westonruter
- Status changed from new to 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:
5 weeks 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.
5 weeks ago
#5
- Keywords has-unit-tests added
@westonruter commented on PR #10803:
5 weeks ago
#6
Closing in favor of https://github.com/WordPress/wordpress-develop/pull/10842
Fix WP_Customize_Media_Control::to_json() extension validation.
Trac ticket: #64557