v1.1.0 changes
[mdref/mdref-json_post] / json_post.md
index 548cefd47ea3e3f2d0966e5aadc0c25a109ed1cf..65ca94def052702d1a20051d4bbe10ddf84b61d3 100644 (file)
@@ -8,9 +8,9 @@ Parse JSON request bodies into `$_POST`.
 
 ## What it does:
 
-This tiny extension provides a PHP content type handler for `text/json` to PHP's form data parser. 
+This tiny extension provides a PHP content type handler for JSON to PHP's form data parser. 
 
-If the `Content-Type` of an incoming request is `text/json`, the JSON contents of the request body will by parsed into `$_POST`.
+If the `Content-Type` of an incoming request is `application/json` or `text/json`, the JSON contents of the request body will by parsed into `$_POST`.
 
 ## Installation:
 
@@ -24,8 +24,30 @@ This extension is hosted at [PECL](http://pecl.php.net) and can be installed wit
 
 ## INI Directives:
 
-* json_post.flags = 1; json_decode() flags
-  * JSON_OBJECT_AS_ARRAY = 1
-  * JSON_BIGINT_AS_STRING = 2
-  * JSON_OBJECT_AS_ARRAY|JSON_BIGINT_AS_STRING = 3
-
+json_post.flags = 1
+:      json_decode() flags
+       * JSON_OBJECT_AS_ARRAY = 1
+       * JSON_BIGINT_AS_STRING = 2
+       * JSON_OBJECT_AS_ARRAY|JSON_BIGINT_AS_STRING = 3
+       * JSON_INVALID_UTF8_IGNORE = 1048576 ; (PHP >= 7.2)
+       * JSON_INVALID_UTF8_SUBSTITUTE = 2097152 ; (PHP >= 7.2)
+       * JSON_THROW_ON_ERROR is ignored
+
+json_post.onerror.response = 0
+:      Send a custom HTTP response status on failure, e.g.:  
+       ; send `HTTP/1.1 400 Bad Request` on error  
+       json_post.onerror.response = 400
+
+json_post.onerror.warning = Off
+:      Raise `E_WARNING` on failure decoding JSON when enabled.
+
+json_post.onerror.exit = Off
+:      Exit PHP without running the script on decoding failure when enabled.
+
+## Changelog:
+
+0. v1.1.0
+       * Ignore JSON_THROW_ON_ERROR in `json_post.flags`.
+       * Add `json_post.onerror.response` INI setting.
+       * Add `json_post.onerror.warning` INI setting.
+       * Add `json_post.onerror.exit` INI setting.