[wp-trac] [WordPress Trac] #60599: REST API: rest_filter_response_fields fails with a PHP fatal when a custom API endpoint returns a scalar value.

WordPress Trac noreply at wordpress.org
Thu Feb 22 09:55:14 UTC 2024


#60599: REST API: rest_filter_response_fields fails with a PHP fatal when a custom
API endpoint returns a scalar value.
----------------------------------------+-----------------------------
 Reporter:  xknown                      |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Future Release
Component:  REST API                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-unit-tests needs-patch  |     Focuses:
----------------------------------------+-----------------------------
Changes (by swissspidy):

 * keywords:  has-patch has-unit-tests => has-unit-tests needs-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 I was just about to say the REST API is not really designed for returning
 scalar data, but this is literally shown as an example in the
 documentation: https://developer.wordpress.org/rest-api/extending-the-
 rest-api/adding-custom-endpoints/.

 A fatal error is a poor experience for sure, so can't hurt to fix this.

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


More information about the wp-trac mailing list