[wp-trac] [WordPress Trac] #56481: Short-circuit HEAD methods in Core controllers

WordPress Trac noreply at wordpress.org
Mon Mar 3 11:59:36 UTC 2025


#56481: Short-circuit HEAD methods in Core controllers
---------------------------------------------+-----------------------------
 Reporter:  TimothyBlynJacobs                |       Owner:
                                             |  TimothyBlynJacobs
     Type:  enhancement                      |      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
---------------------------------------------+-----------------------------
Changes (by Mamaduka):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 The Gutenberg e2e tests discovered a possible fatal error coming from
 `rest_filter_response_fields` - ` PHP Fatal error:  Uncaught TypeError:
 array_intersect_key(): Argument #1 ($array) must be of type array, null
 given`.


 == How to reproduce

 * Make a `HEAD` request with the `_fields` argument. This triggers an
 error since response data is now a `null`.


 I'm guessing that the usage in Gutenberg was related to previous behavior,
 and the client code was trying to limit the response size.

 Props to @abcd95 for discovering the initial connection -
 https://github.com/WordPress/gutenberg/pull/69378#issuecomment-2693912904.

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


More information about the wp-trac mailing list