Opened 2 years ago
Last modified 20 months ago
#56261 accepted enhancement
Normalize comment function parameters with mixed case names
Reported by: | SergeyBiryukov | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | needs-patch |
Focuses: | docs, coding-standards | Cc: |
Description
Background: #56244
As of WordPress 2.9, core normalizes the user_ID
parameter to user_id
when passing data to comment functions, see [12267], [12300], and [28915].
We should consider normalizing other parameters in the same way as it was done for user_ID
→ user_id
:
comment_ID
→comment_id
comment_post_ID
→comment_post_id
comment_author_IP
→comment_author_ip
Then any combination of these parameters would work regardless of the case.
This would allow extenders to name variables in accordance with the WordPress coding standards:
$comment_id
$comment_post_id
$comment_author_ip
and use them subsequently in a compact()
call without having to worry about a case mismatch.
This would also allow us to revert some of compact()
rearrangements made in [53719] and [53723]:
$compacted = array( 'comment_post_ID' => $comment_post_id, 'comment_author_IP' => $comment_author_ip, ); $compacted += compact( 'comment_author', 'comment_author_email', 'comment_author_url', ... 'user_id' );
which could then be:
$compacted = compact( 'comment_post_id', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_ip', ... 'user_id' );
The list of functions this may affect:
wp_insert_comment()
wp_new_comment()
wp_update_comment()
wp_filter_comment()
wp_handle_comment_submission()
Change History (10)
#2
in reply to:
↑ description
@
2 years ago
This ticket was mentioned in Slack in #core by sergey. View the logs.
2 years ago
This ticket was mentioned in Slack in #core by costdev. View the logs.
21 months ago
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
20 months ago
#7
@
20 months ago
- Keywords needs-patch added
This ticket was discussed in the recent bug scrub.
@SergeyBiryukov Is this a to-do item for you, and will you submit a patch?
Props to @costdev
Replying to SergeyBiryukov:
To clarify a bit, this aims to fix WPCS issues like this: