Skip to content

Commit 36530f0

Browse files
committed
Type-check filter results at call-sites to avoid type errors.
1 parent a931a3f commit 36530f0

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ static function ( $format ) {
442442
* @param WP_REST_Request $request The REST API request.
443443
*/
444444
$args = apply_filters( "rest_{$this->post_type}_query", $args, $request );
445+
$args = is_array( $args ) ? $args : array();
445446
$query_args = $this->prepare_items_query( $args, $request );
446447

447448
$posts_query = new WP_Query();

src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public function get_items( $request ) {
299299

300300
/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
301301
$args = apply_filters( 'rest_revision_query', $args, $request );
302+
$args = is_array( $args ) ? $args : array();
302303
$query_args = $this->prepare_items_query( $args, $request );
303304

304305
$revisions_query = new WP_Query();

0 commit comments

Comments
 (0)