[wp-trac] [WordPress Trac] #56244: Use a consistent parameter name for functions accepting a comment ID or object

WordPress Trac noreply at wordpress.org
Thu Jul 21 11:43:55 UTC 2022


#56244: Use a consistent parameter name for functions accepting a comment ID or
object
----------------------------+-------------------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  enhancement     |      Status:  accepted
 Priority:  normal          |   Milestone:  6.1
Component:  Comments        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  docs, coding-standards
----------------------------+-------------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:16 peterwilsoncc]:
 > With the patch applied `isset( $commentdata['user_ID'] )` will always
 return `true` after the filter, which wasn't necessarily the case before.
 My reading of the code is that once the filter runs, `user_ID` will take
 priority over `user_id` which seems the opposite of what you want here.

 Thanks! It looks like setting both fields in the re-normalization may have
 been redundant:
 {{{
 $commentdata['user_ID'] = (int) $commentdata['user_ID'];
 $commentdata['user_id'] = $commentdata['user_ID']
 }}}
 [attachment:"56244.2.diff"] replaces that with:
 {{{
 $commentdata['user_id'] = (int) $commentdata['user_ID'];
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56244#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list