748374ae31f4c50f9593ac4549cd65c914125fba
[m6w6/ext-json_post] / tests / error005.phpt
1 --TEST--
2 json_post with malformed JSON (https://github.com/m6w6/ext-json_post/issues/3)
3 --SKIPIF--
4 <?php
5 extension_loaded("json_post") or die("skip need json_post support\n");
6 if (PHP_VERSION_ID < 70000) doe("skip need PHP-7.0+\n");
7 ?>
8 --INI--
9 json_post.error_response = 444
10 json_post.flags = 1
11 --POST_RAW--
12 Content-Type: application/json
13
14 {
15 "greeting": "Hello World
16 }
17 --FILE--
18 <?php
19 http_response_code(400);
20 var_dump($_POST);
21 var_dump(http_response_code());
22 ?>
23 Done
24 --EXPECTHEADERS--
25 Status: 400 Bad Request
26 X-JSON-Error-Code: 3
27 --EXPECTF--
28 array(0) {
29 }
30 int(400)
31 Done