#66274 closed defect (bug) (invalid)
wp_get_state_style_with_fallback_dimension_styles unused since WP 7.1.2
| Reported by: | marian1 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| 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 (5)
This ticket was mentioned in PR #14121 on WordPress/wordpress-develop by @abditsori.
5 weeks ago
#1
- Keywords has-patch has-unit-tests added
#2
@
5 weeks 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.
#3
@
5 weeks ago
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.
I don't believe the call was ever added to core as it's not in the sync PR for the change that moved its place in gutenberg: https://github.com/WordPress/wordpress-develop/pull/12159.
The function should not be removed but the call added in the right place. I've opened https://core.trac.wordpress.org/ticket/66275 and https://github.com/WordPress/wordpress-develop/pull/14126 to do that.
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.