#48817 closed defect (bug) (fixed)
do_action_deprecated and apply_filters_deprecated $replacement param should default to null
| Reported by: | felipeelia | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.4 |
| Component: | Plugins | Version: | |
| Severity: | normal | Keywords: | good-first-bug has-patch |
| Cc: | Focuses: |
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)
#4
in reply to: ↑ description
@
7 years ago
- Keywords dev-feedback added
This ticket was mentioned in Slack in #core by ihtishamzahoor. View the logs.
7 years ago
#7
follow-up:
↓ 8
@
7 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.
@
7 years ago
Reverted previous changes and assigned the default values to both of the functions as NULL
#8
in reply to: ↑ 7
@
7 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
@
7 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Replying to felipeelia:
Hi,
This ticket looks interesting. Can you please provide any screenshot or the hook that is causing the issue?
Thanks.