Opened 4 hours ago
Last modified 2 hours ago
#66274 new defect (bug)
wp_get_state_style_with_fallback_dimension_styles unused since WP 7.1.2
| Reported by: | marian1 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Editor | Version: | |
| Severity: | trivial | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
wp_get_state_style_with_fallback_dimension_styles() was introduced in WP 7.1. The only call to it was removed in WP 7.1.2.
The function should either be removed, deprecated, or receive a comment explaining why it remains undeprecated despite no longer being used.
Change History (2)
This ticket was mentioned in PR #14121 on WordPress/wordpress-develop by @abditsori.
3 hours ago
#1
- Keywords has-patch has-unit-tests added
#2
@
2 hours ago
- Keywords needs-patch added; has-patch has-unit-tests removed
- Milestone Awaiting Review → 7.2
There are no uses in plugins on the directory: https://veloria.dev/search/f7ec6f89-c665-4c26-b049-2b78f62decc6
Same for themes: https://veloria.dev/search/a0a3702f-9890-4b25-976a-5162b1eb1dc0
That said, moving to deprecated.php is safer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
https://core.trac.wordpress.org/ticket/66274
Summary
wp_get_state_style_with_fallback_dimension_styles()was introduced in 6152d85efd ("Editor: add support for aspect ratio and related controls in viewport states"). Its only call site was removed in a later refactor, 1caffb5277 ("Editor: fix responsive element styles front end output.", fixes #65164), when the inline logic that called it was replaced by a newwp_add_block_state_style_rule()helper that doesn't call it.Since then the function has had zero callers anywhere in core, confirmed via:
which only matches its own definition.
Changes
wp_get_state_style_with_fallback_dimension_styles()fromwp-includes/block-supports/states.php.test_adds_fallback_dimension_styles_for_aspect_ratio,test_does_not_add_fallback_dimension_styles_for_default_aspect_ratio,test_adds_fallback_aspect_ratio_style_for_height) fromtests/phpunit/tests/block-supports/states.php.wp_is_explicit_aspect_ratio_value()(used inside the removed function) is still called elsewhere inblock-supports/dimensions.php, so it was left untouched.Test plan
php -lon both changed files.tests/phpunit/tests/block-supports/states.php— 43 tests, 69 assertions, all passing.