[wp-trac] [WordPress Trac] #53218: Make apply_filters() variadic
WordPress Trac
noreply at wordpress.org
Sun May 16 18:51:45 UTC 2021
#53218: Make apply_filters() variadic
-------------------------+----------------------------
Reporter: johnbillion | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Plugins | Version: 5.3
Severity: normal | Keywords: needs-patch
Focuses: |
-------------------------+----------------------------
Previously in #47678 most functions in core that call `func_get_args()`
were converted to variadic functions. One exception is `apply_filters()`
which was left as-is due to a concern about filters which pass (and
expect) a value by reference:
> `WP_Hooks::apply_filters()` can not be simplified further as - even
within WP Core -, there are filter functions which expect to receive the
`$value` to be filtered by reference.
Ref: https://core.trac.wordpress.org/ticket/47678#comment:31
It does seem however that this function can be made variadic by adding an
additional parameter after `$value` instead of making `$value` variadic.
The existing tests pass with this change, but the test coverage might not
be sufficient.
There are two potential outcomes to this ticket:
1. Make `apply_filters()` variadic by adding an additional `...$args`
parameter, leaving the existing `$value` parameter alone, or
2. Add tests which demonstrate why this cannot be done
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53218>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list