#49698 closed defect (bug) (fixed)
Issue with replacement for filter deprecation
| Reported by: | renathoc | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5 |
| Component: | Plugins | Version: | 5.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
The function apply_filters_deprecated has the default value for the $replacement argument as false.
This function uses the _deprecated_hook, sending the same $replacement argument. But in the _deprecated_hook, it considers the default as null.
So the problem occurs when we use the apply_filters_deprecated without a replacement, the with no alternative available message is not shown, but Use instead.
Attachments (1)
Change History (7)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi there, welcome to WordPress Trac! Thanks for the ticket.
The issue is already fixed for WordPress 5.4 in [46792] / #48817.
That said, I think we should switch the default values for
$replacementand$messageparameters in these functions to an empty string instead ofnull, to match the documented type ofstring. The! is_null()check for these parameters seems unnecessarily strict, we only need to check for a truthy value.This would affect:
_deprecated_function()_deprecated_constructor()_deprecated_file()_deprecated_argument()_deprecated_hook()apply_filters_deprecated()do_action_deprecated()