diff --git a/language/errors/php7.xml b/language/errors/php7.xml index 49fbdcfb1072..55400297825c 100644 --- a/language/errors/php7.xml +++ b/language/errors/php7.xml @@ -75,6 +75,9 @@ FiberError + + RequestParseBodyException + diff --git a/language/predefined/exceptions.xml b/language/predefined/exceptions.xml index d655ffb6335c..14a3f914d56c 100644 --- a/language/predefined/exceptions.xml +++ b/language/predefined/exceptions.xml @@ -27,6 +27,7 @@ &language.predefined.valueerror; &language.predefined.unhandledmatcherror; &language.predefined.fibererror; + &language.predefined.requestparsebodyexception; + + RequestParseBodyException + RequestParseBodyException + + + + +
+ &reftitle.intro; + + A RequestParseBodyException is thrown in + request_parse_body when the request body is invalid, + according to the Content-Type header. + +
+ + +
+ &reftitle.classsynopsis; + + + + + RequestParseBodyException + + + + extends + Exception + + + &InheritedProperties; + + + + + &InheritedMethods; + + + + + + + + + + +
+
+
+ diff --git a/language/predefined/versions.xml b/language/predefined/versions.xml index d79b0320fb76..122484e8f9e1 100644 --- a/language/predefined/versions.xml +++ b/language/predefined/versions.xml @@ -101,6 +101,8 @@ + + diff --git a/reference/network/functions/request-parse-body.xml b/reference/network/functions/request-parse-body.xml new file mode 100644 index 000000000000..2dea65b633bc --- /dev/null +++ b/reference/network/functions/request-parse-body.xml @@ -0,0 +1,148 @@ + + + + request_parse_body + Read and parse the request body and return the result + + + + &reftitle.description; + + arrayrequest_parse_body + arraynulloptions&null; + + + This function reads the request body and parses it according to the + Content-Type header. Currently, two content types are + supported: + + + + + application/x-www-form-urlencoded + + + + + multipart/form-data + + + + + This function is used primarily to parse + multipart/form-data requests with HTTP verbs other than + POST which do not automatically populate the + $_POST and $_FILES superglobals. + + + + + request_parse_body consumes the request body without + buffering it to the php://input stream. + + + + + + &reftitle.parameters; + + + options + + + The options parameter accepts an associative array + to override the following global &php.ini; settings for parsing of the + request body. + + + max_file_uploads + max_input_vars + max_multipart_body_parts + post_max_size + upload_max_filesize + + + + + + + + &reftitle.returnvalues; + + request_parse_body returns an array pair with the + equivalent of $_POST at index 0 and + $_FILES at index 1. + + + + + &reftitle.errors; + + When the request body is invalid, + according to the Content-Type header, + a RequestParseBodyException is thrown. + + + A ValueError is thrown when + options contains invalid keys, + or invalid values for the corresponding key. + + + + + &reftitle.examples; + + <function>request_parse_body</function> example + + +]]> + + + + <function>request_parse_body</function> example with customized options + + '10M', + 'upload_max_filesize' => '10M', +]); + +// Do something with the uploaded files. +?> +]]> + + + + + diff --git a/reference/network/versions.xml b/reference/network/versions.xml index 424810d9a6e1..bd08fcc45831 100644 --- a/reference/network/versions.xml +++ b/reference/network/versions.xml @@ -34,6 +34,7 @@ +