#48817 closed defect (bug) (fixed)
do_action_deprecated and apply_filters_deprecated $replacement param should default to null
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.4 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Plugins | Keywords: | good-first-bug has-patch |
| Focuses: | Cc: |
Description
_deprecated_hook, the function responsible for logging an error when an old hook is called, uses is_null to check if a $replacement was provided.
The problem is that $replacement defaults to false (instead of null) on apply_filters_deprecated and do_action_deprecated, displaying the Use %3$s instead.' message without any value.
Attachments (3)
Change History (14)
#3
@
6 years ago
- Component changed from General to Plugins
- Milestone changed from Awaiting Review to 5.4
#4
in reply to:
↑ description
@
6 years ago
- Keywords dev-feedback added
This ticket was mentioned in Slack in #core by ihtishamzahoor. View the logs.
6 years ago
#7
follow-up:
↓ 8
@
6 years ago
Hi @shaampk1, thanks for the patch! However, looks like that's not quite what the ticket meant.
Unlike arrays, sprint() calls don't require the extra comma and in fact will produce a syntax error with that change.
The suggested change is to switch $replacement = false in lines 626 and 653 of wp-includes/plugin.php to $replacement = null, as that is the value being checked in _deprecated_hook() and other related functions, see line 4839 in wp-includes/functions.php.
@
6 years ago
Reverted previous changes and assigned the default values to both of the functions as NULL
#8
in reply to:
↑ 7
@
6 years ago
Hi, @SergeyBiryukov,
Thanks for the quick assistance. I have just submitted a new patch, could you also please take a quick look. Thanks : )
#9
@
6 years ago
- Keywords dev-feedback removed
Hey @shaampk1! Yes, the last patch addresses what I was trying to highlight :)
I've noticed the problem while hooking a function to the delete_blog action and I guess that that and deleted_blog actions are the only ones that don't provide any replacement.
Replying to felipeelia:
Hi,
This ticket looks interesting. Can you please provide any screenshot or the hook that is causing the issue?
Thanks.