[wp-trac] [WordPress Trac] #56481: Short-circuit HEAD methods in Core controllers
WordPress Trac
noreply at wordpress.org
Tue Mar 11 14:17:58 UTC 2025
#56481: Short-circuit HEAD methods in Core controllers
---------------------------------------------+-----------------------------
Reporter: TimothyBlynJacobs | Owner:
| TimothyBlynJacobs
Type: task (blessed) | Status: reopened
Priority: normal | Milestone: 6.8
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests commit | Focuses: rest-api,
| performance
---------------------------------------------+-----------------------------
Comment (by TimothyBlynJacobs):
In [changeset:"59970" 59970]:
{{{
#!CommitTicketReference repository="" revision="59970"
REST API: Fix fatal error when making HEAD requests with _fields filter.
In [59889] the REST API controllers were adjusted to perform less work
when responding to HEAD requests. The WP_REST_Response body would now be
`null`, which caused issues with filters that expected the response body
to be an array.
This commit sets the response body to be an empty array when preparing the
response instead. The body will still be discarded, but this provides
better backward comppatibility with code that assumes an array will be
used.
See #56481.
Props antonvlasenko, timothyblynjacobs, mamaduka, wildworks.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56481#comment:61>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list