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

WordPress Trac noreply at wordpress.org
Fri Jul 22 02:10:46 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 peterwilsoncc):

 Replying to [comment:17 SergeyBiryukov]:
 > Thanks! It looks like setting both fields in the re-normalization may
 have been redundant:

 I am beginning to think we need `WP_Case_Insensitive_Array_Like_Object`
 (but that too would break plugins using `is_array()`). :)

 It appears some plugins are expecting `user_id` on the filter, other
 `user_ID` and there is no nice way for core to determine accurately which
 ought to be preferred after the filter is run.

 Re: my comment yesterday

 > With the patch applied `isset( $commentdata['user_ID'] )` will always
 return `true` after the filter...

 It occurred to me overnight that I was wrong. If a plugin reconstructs the
 array in it's entirety using `user_id` then this will be false.

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


More information about the wp-trac mailing list