[wp-trac] [WordPress Trac] #39871: REST API: Revision author ID is returned as a string

WordPress Trac noreply at wordpress.org
Tue Feb 14 09:36:56 UTC 2017


#39871: REST API: Revision author ID is returned as a string
--------------------------+--------------------------------------
 Reporter:  jnylen0       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.7.3
Component:  REST API      |    Version:  4.7
 Severity:  normal        |   Keywords:  has-patch has-unit-tests
  Focuses:                |
--------------------------+--------------------------------------
 Apparently `post_author` is a string in the WP internals,
 "[https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes
 /class-wp-post.php?marks=34#L31 for compatibility reasons]".

 In `WP_REST_Posts_Controller` we
 [https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/rest-
 api/endpoints/class-wp-rest-posts-controller.php#L1469 cast it to an
 integer] before returning it in the response.

 In `WP_REST_Revisions_Controller` we
 [https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/rest-
 api/endpoints/class-wp-rest-revisions-controller.php#L346 don't do the
 corresponding cast].

 The result is that the `author` ID is returned as a string, even though it
 is documented as an integer for both
 [https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/rest-
 api/endpoints/class-wp-rest-posts-controller.php?marks=1896#L1893 posts]
 and [https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes
 /rest-api/endpoints/class-wp-rest-revisions-controller.php?marks=472#L469
 revisions].

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


More information about the wp-trac mailing list