[wp-trac] [WordPress Trac] #41457: WP_REST_Comments_Controller::check_read_post_permission() counts an uncountable value

WordPress Trac noreply at wordpress.org
Fri Jul 28 10:35:16 UTC 2017


#41457: WP_REST_Comments_Controller::check_read_post_permission() counts an
uncountable value
------------------------------------------+-----------------------
 Reporter:  johnbillion                   |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  4.9
Component:  Comments                      |     Version:  4.7
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  rest-api
------------------------------------------+-----------------------

Comment (by ayeshrajans):

 To replicate the `count($request['post'])`, here are the variable types
 that return (int) 1 for `count($request['post'])` calls:

  - true
  - false
  - 'foobar' (any string)
  - array(1)
  - any object. Even an empty `stdClass` object returns int 1 for count()
 calls.

 Ref: https://3v4l.org/1mkY5

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


More information about the wp-trac mailing list