[wp-trac] [WordPress Trac] #57690: The get_delete_post_link function uses the deprecated parameter
WordPress Trac
noreply at wordpress.org
Sat Feb 11 13:02:01 UTC 2023
#57690: The get_delete_post_link function uses the deprecated parameter
------------------------------------+-------------------------------
Reporter: krunal265 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.2
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch commit php81 | Focuses: coding-standards
------------------------------------+-------------------------------
Comment (by SergeyBiryukov):
Replying to [comment:1 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 the `get_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 as `null` instead of an empty string.
* Passing `null`, while technically incorrect, still works as expected and
does not trigger the deprecated argument notice, as `null` 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 [source:tags/6.1.1/src/wp-admin/includes/class-
wp-posts-list-table.php?marks=1479#L1476 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57690#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list