From c044382c6bacd6919b5ae817834d96764baa47dd Mon Sep 17 00:00:00 2001 From: John Watkins Date: Fri, 19 Jan 2024 10:09:27 -0600 Subject: [PATCH 1/2] Fix deprecation warning for htmlspecialchars --- wp/headless-wp/includes/classes/API.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp/headless-wp/includes/classes/API.php b/wp/headless-wp/includes/classes/API.php index a2ad7dea4..9dbc678b9 100644 --- a/wp/headless-wp/includes/classes/API.php +++ b/wp/headless-wp/includes/classes/API.php @@ -98,7 +98,7 @@ public function modify_rest_params( $args, $request ) { return $args; } - $author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) ); + $author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) ?? '' ); if ( ! empty( $author ) && ! is_numeric( $author ) ) { unset( $args['author__in'] ); @@ -108,10 +108,10 @@ public function modify_rest_params( $args, $request ) { $taxonomies = wp_list_filter( get_object_taxonomies( $args['post_type'], 'objects' ), [ 'show_in_rest' => true ] ); foreach ( $taxonomies as $taxonomy ) { - $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) ); + $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) ?? '' ); if ( ! $term ) { - $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) ); + $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) ?? '' ); } if ( ! empty( $term ) && ! is_numeric( $term ) ) { From 306f8da1b8663423a98f87ff49084917242b9ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcholas=20Andr=C3=A9?= Date: Fri, 19 Jan 2024 15:00:10 -0300 Subject: [PATCH 2/2] chore: changelog --- .changeset/cyan-badgers-smile.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cyan-badgers-smile.md diff --git a/.changeset/cyan-badgers-smile.md b/.changeset/cyan-badgers-smile.md new file mode 100644 index 000000000..4d9dce2b8 --- /dev/null +++ b/.changeset/cyan-badgers-smile.md @@ -0,0 +1,5 @@ +--- +"@headstartwp/headstartwp": patch +--- + +Ensure htmlspecialchars receives an empty string instead of null to fix deprecation warnings.