From 1c0fb05d62a19f65e4e1b7610fdeaba13060afdd Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Thu, 3 Aug 2023 16:45:41 -0600 Subject: [PATCH 1/2] - replace `filter_input` with `sanitize_text_field` --- src/Admin/Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Settings.php b/src/Admin/Settings.php index a92cebb..44b6940 100644 --- a/src/Admin/Settings.php +++ b/src/Admin/Settings.php @@ -151,7 +151,7 @@ public function graphql_types_ajax_callback(): void { } // @phpstan-ignore-next-line - if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING ), 'wp_graphql_acf' ) ) { + if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'wp_graphql_acf' ) ) { wp_send_json_error(); } From ae24aa8e95a25ac8c6a1e671a68d4e121f2ceeb7 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Thu, 3 Aug 2023 16:57:34 -0600 Subject: [PATCH 2/2] - remove phpstan ignore --- src/Admin/Settings.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Admin/Settings.php b/src/Admin/Settings.php index 44b6940..a2e9de7 100644 --- a/src/Admin/Settings.php +++ b/src/Admin/Settings.php @@ -150,7 +150,6 @@ public function graphql_types_ajax_callback(): void { wp_send_json( __( 'No form data.', 'wp-graphql-acf' ) ); } - // @phpstan-ignore-next-line if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'wp_graphql_acf' ) ) { wp_send_json_error(); }