Opened 20 months ago
Closed 20 months ago
#57690 closed defect (bug) (fixed)
The get_delete_post_link function uses the deprecated parameter
Reported by: | krunal265 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Options, Meta APIs | Keywords: | has-patch commit php81 |
Focuses: | coding-standards | Cc: |
Description
https://developer.wordpress.org/reference/functions/get_delete_post_link/
The parameter "null" at position 2 of get_delete_post_link() has been deprecated since WordPress version 3.0.0. We can use "" instead.
File path: wp-admin/includes/meta-boxes.php
Line number: 475
Attachments (1)
Change History (4)
#1
follow-up:
↓ 2
@
20 months ago
- Keywords commit php81 added
- Milestone changed from Awaiting Review to 6.2
@krunal265 Thanks for this ticket and the patch. I've reviewed the issue and the patch and I concur this is the correct fix.
Two questions:
- Would it be possible to add a unit test for the function to safeguard the fix against regressions ?
- Might it be a good idea to do a code search of the whole WP Core code base for all uses of the
get_delete_post_link()
function to review and verify that this issue doesn't exist in more places ?
Note for committers: the patch as-is can go in. Potential results from follow-up actions resulting from my questions can be handled separately (and tests can still go in during beta).
#2
in reply to:
↑ 1
@
20 months ago
Replying to jrf:
Would it be possible to add a unit test for the function to safeguard the fix against regressions ?
Good question:
- The
$deprecated
parameter is not used in theget_delete_post_link()
function itself, aside from throwing a_deprecated_argument()
notice. attachment_submit_meta_box()
is the only function in core that passes this parameter asnull
instead of an empty string.- Passing
null
, while technically incorrect, still works as expected and does not trigger the deprecated argument notice, asnull
is considered an empty value.
So it's not immediately clear to me how to write a test case for this. We can follow up later if anyone comes up with an idea :)
Might it be a good idea to do a code search of the whole WP Core code base for all uses of the
get_delete_post_link()
function to review and verify that this issue doesn't exist in more places ?
There appears to be only one other instance in core where this parameter is passed to get_delete_post_link()
, and it's correctly passed as an empty string there.
Patch added