[wp-trac] [WordPress Trac] #37684: Allow sites to have filterable "states" akin to posts & media

WordPress Trac noreply at wordpress.org
Mon Oct 7 23:26:48 UTC 2019


#37684: Allow sites to have filterable "states" akin to posts & media
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:
                                                 |  johnjamesjacoby
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  5.3
Component:  Networks and Sites                   |     Version:  3.0
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  2nd-opinion has-patch needs-dev-     |     Focuses:  multisite
  note                                           |
-------------------------------------------------+-------------------------

Comment (by pbiron):

 Replying to [comment:30 pbiron]:
 > Can we reopen this to get that new patch committed?

 Before
 [https://core.trac.wordpress.org/attachment/ticket/37684/37684.4.diff
 37684.4.diff] gets committed, I have a question.

 @garrett-eclipse pointed out to me that:

 * the conditional `if ( $_site->{$status} == 1 )` should use a Yoda
 condition

 And while talking to him about that, I realized that that comparison
 should be strict if at all possible (according to WPCS).

 As far as I can tell, `$_site` is **always** a direct row from the blogs
 table and hence, the values in the various status properties will
 **always** be strings (either `"0"` or `"1"`).  Can anyone confirm that?

 Or was the comparison (introduced in
 [https://core.trac.wordpress.org/attachment/ticket/37684/37684.03.diff
 37684.03.diff] and carried through all the subsequent patches) made loose
 intentionally because under some circumstances those properties might be
 ints?

 For WPCS purposes, would it make sense to do:

 * `if ( 1 === intval( $_sites->{$status} ) )`

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


More information about the wp-trac mailing list