[wp-trac] [WordPress Trac] #39010: REST API: Treat null and other falsy values like `false` in 'rest_allow_anonymous_comments'

WordPress Trac noreply at wordpress.org
Thu Dec 1 18:50:18 UTC 2016


#39010: REST API: Treat null and other falsy values like `false` in
'rest_allow_anonymous_comments'
--------------------------+--------------------------------------
 Reporter:  jnylen0       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.7
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch has-unit-tests
  Focuses:                |
--------------------------+--------------------------------------
 Currently the `rest_allow_anonymous_comments` filter checks for an
 explicit `false` value to disable anonymous comments.  We should extend
 this check to any falsy value instead.

 As noted in the tests, the specific case I'm envisioning is that a plugin
 developer forgets to include a return value for some code path in their
 callback for this filter, leading to a value of `null` which is currently
 treated like `true`.  We should fix this before it has a chance to show up
 in the wild.

 Props @joehoyle for originally spotting this at ticket:38855#comment:6,
 but it wasn't addressed in the commit there.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39010>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list