+
+static SAPI_POST_HANDLER_FUNC(php_json_post_handler)
+{
+ zval *zarg = arg;
+ char *json_str = NULL;
+ size_t json_len = 0;
+
+# if PHP_VERSION_ID >= 50600
+ if (!SG(request_info).request_body) {
+ return;
+ }
+
+ /* FG(stream_wrappers) not initialized yet, so we cannot use php://input */
+ php_stream_rewind(SG(request_info).request_body);
+ json_len = php_stream_copy_to_mem(SG(request_info).request_body, &json_str, PHP_STREAM_COPY_ALL, 0);
+# else