Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | function accept_tos() { |
||
18 | check_ajax_referer( 'wp_ajax_action', '_nonce' ); |
||
19 | |||
20 | $response = Client::wpcom_json_api_request_as_user( |
||
21 | '/legal', |
||
22 | '2', |
||
23 | array( |
||
24 | 'method' => 'POST', |
||
25 | ), |
||
26 | array( |
||
|
|||
27 | 'action' => 'accept_tos', |
||
28 | ) |
||
29 | ); |
||
30 | |||
31 | if ( is_wp_error( $response ) ) { |
||
32 | wp_send_json_error( array( 'message' => __( 'Could not accept the Terms of Service. Please try again later.', 'jetpack' ) ) ); |
||
33 | wp_die(); |
||
34 | } |
||
35 | |||
36 | wp_send_json_success( $response ); |
||
37 | |||
38 | wp_die(); |
||
39 | } |
||
40 | |||
42 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: