| @@ -93,9 +93,12 @@ | ||
| 93 | 93 | wp_send_json_error( __( 'Nonce verification failed.', 'sureforms' ) ); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // get body data. |
| 97 | - $body = json_decode( $request->get_body(), true ); | |
| 97 | + // get_body() is null for an empty request, and passing null to json_decode() | |
| 98 | + // is deprecated on PHP 8.1+ - the notice lands in the response body and makes | |
| 99 | + // the JSON unparseable wherever display_errors is on. | |
| 100 | + $body = json_decode( Helper::get_string_value( $request->get_body() ), true ); | |
| 98 | 101 | |
| 99 | 102 | if ( empty( $body ) ) { |
| 100 | 103 | wp_send_json_error( [ 'message' => __( 'Error processing Access Key.', 'sureforms' ) ] ); |
| 101 | 104 | } |