From dffc9e5c40109d1847e2d22ae019a2b8177fb81e Mon Sep 17 00:00:00 2001 From: "SUMIDA, Ippei" Date: Sun, 8 Dec 2024 17:49:06 +0900 Subject: [PATCH 1/3] =?UTF-8?q?request=5Fparse=5Fbody=E3=81=AE=E7=BF=BB?= =?UTF-8?q?=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- language/errors/php7.xml | 5 +- language/predefined/exceptions.xml | 3 +- .../predefined/requestparsebodyexception.xml | 65 +++++++++ .../network/functions/request-parse-body.xml | 136 ++++++++++++++++++ 4 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 language/predefined/requestparsebodyexception.xml create mode 100644 reference/network/functions/request-parse-body.xml diff --git a/language/errors/php7.xml b/language/errors/php7.xml index de8d5e146c9..1e0d2439d4c 100644 --- a/language/errors/php7.xml +++ b/language/errors/php7.xml @@ -1,6 +1,6 @@ - + @@ -80,6 +80,9 @@ FiberError + + RequestParseBodyException + diff --git a/language/predefined/exceptions.xml b/language/predefined/exceptions.xml index b4806681c2f..3ab289e4bf5 100644 --- a/language/predefined/exceptions.xml +++ b/language/predefined/exceptions.xml @@ -1,6 +1,6 @@ - + @@ -29,6 +29,7 @@ &language.predefined.valueerror; &language.predefined.unhandledmatcherror; &language.predefined.fibererror; + &language.predefined.requestparsebodyexception; + + + + RequestParseBodyException + RequestParseBodyException + + +
+ &reftitle.intro; + + RequestParseBodyException は、 request_parse_body 内で + リクエストボディが無効な場合にスローされます。 + これは、 Content-Type ヘッダーに基づいて判断されます。 + +
+ +
+ &reftitle.classsynopsis; + + + + RequestParseBodyException + + + extends + Exception + + &InheritedProperties; + + + + &InheritedMethods; + + + + + + + + +
+
+
+ diff --git a/reference/network/functions/request-parse-body.xml b/reference/network/functions/request-parse-body.xml new file mode 100644 index 00000000000..e8435162b49 --- /dev/null +++ b/reference/network/functions/request-parse-body.xml @@ -0,0 +1,136 @@ + + + + + + + request_parse_body + リクエストボディを読み取り、解析して結果を返します + + + &reftitle.description; + + arrayrequest_parse_body + arraynulloptions&null; + + + この関数は リクエストボディを読み取り、Content-Type ヘッダーに基づき解析します。 + 現在、2つのコンテンツタイプをサポートしています: + + + + + application/x-www-form-urlencoded + + + + + multipart/form-data + + + + + この関数は、 POST 以外のHTTPメソッドで送信された multipart/form-data を解析するために使用されます。 + これらのリクエストでは、スーパーグローバルの $_POST$_FILES は自動的に設定されません。 + + + + request_parse_body は、リクエストボディを php://input ストリームにバッファせずに処理します。 + + + + + &reftitle.parameters; + + + options + + + options パラメータは連想配列を受け取り、 + リクエストボディの解析に関連する以下のグローバル &php.ini; の設定を上書きします。 + + + max_file_uploads + max_input_vars + max_multipart_body_parts + post_max_size + upload_max_filesize + + + + + + + &reftitle.returnvalues; + + request_parse_body は、 $_POST に相当するものを + インデックス 0 に、 $_FILES に相当するものを 1 に + 持つ配列ペアを返します。 + + + + &reftitle.errors; + + Content-Type ヘッダーに基づいて解析を試み、リクエストボディが無効な場合、 + RequestParseBodyException をスローします。 + + + options に無効なキーが含まれている、 + または、対応するキーに無効な値が設定されている場合は、 + ValueError をスローします。 + + + + &reftitle.examples; + + <function>request_parse_body</function> の例 + + +]]> + + + + オプションを設定した <function>request_parse_body</function> の例 + + '10M', + 'upload_max_filesize' => '10M', +]); +// Do something with the uploaded files. +?> +]]> + + + + + From 5d896b9f198adca081aa86dda6be8f780eabe367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 8 Dec 2024 21:13:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E6=94=B9=E8=A1=8C=E3=82=84=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=87=E3=83=B3=E3=83=88=E3=82=92=E5=8E=9F=E6=96=87?= =?UTF-8?q?=E3=81=A8=E6=8F=83=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../predefined/requestparsebodyexception.xml | 21 +++++++++++----- .../network/functions/request-parse-body.xml | 24 ++++++++++++++----- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/language/predefined/requestparsebodyexception.xml b/language/predefined/requestparsebodyexception.xml index 184dd3c25cd..179733b9687 100644 --- a/language/predefined/requestparsebodyexception.xml +++ b/language/predefined/requestparsebodyexception.xml @@ -5,32 +5,39 @@ RequestParseBodyException RequestParseBodyException + - + +
&reftitle.intro; - RequestParseBodyException は、 request_parse_body 内で - リクエストボディが無効な場合にスローされます。 + RequestParseBodyException は、 + request_parse_body 内でリクエストボディが無効な場合にスローされます。 これは、 Content-Type ヘッダーに基づいて判断されます。
- + +
&reftitle.classsynopsis; - + + RequestParseBodyException + extends Exception + &InheritedProperties; + &InheritedMethods; @@ -39,7 +46,9 @@ - + + +
diff --git a/reference/network/functions/request-parse-body.xml b/reference/network/functions/request-parse-body.xml index e8435162b49..c43887b755a 100644 --- a/reference/network/functions/request-parse-body.xml +++ b/reference/network/functions/request-parse-body.xml @@ -7,6 +7,7 @@ request_parse_body リクエストボディを読み取り、解析して結果を返します + &reftitle.description; @@ -14,7 +15,8 @@ arraynulloptions&null; - この関数は リクエストボディを読み取り、Content-Type ヘッダーに基づき解析します。 + この関数は リクエストボディを読み取り、 + Content-Type ヘッダーに基づき解析します。 現在、2つのコンテンツタイプをサポートしています: @@ -30,15 +32,19 @@
- この関数は、 POST 以外のHTTPメソッドで送信された multipart/form-data を解析するために使用されます。 - これらのリクエストでは、スーパーグローバルの $_POST$_FILES は自動的に設定されません。 + この関数は、 POST 以外のHTTPメソッドで送信された + multipart/form-data を解析するために使用されます。 + これらのリクエストでは、スーパーグローバルの + $_POST$_FILES は自動的に設定されません。 - request_parse_body は、リクエストボディを php://input ストリームにバッファせずに処理します。 + request_parse_body は、リクエストボディを + php://input ストリームにバッファせずに処理します。 + &reftitle.parameters; @@ -60,6 +66,7 @@ + &reftitle.returnvalues; @@ -68,6 +75,7 @@ 持つ配列ペアを返します。 + &reftitle.errors; @@ -80,12 +88,13 @@ ValueError をスローします。 + &reftitle.examples; <function>request_parse_body</function> の例 - オプションを設定した <function>request_parse_body</function> の例 - '10M', 'upload_max_filesize' => '10M', ]); + // Do something with the uploaded files. ?> ]]> From df696b8b7cf1a16a63511da766c87480a25bd6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 8 Dec 2024 21:14:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A6=8B=E5=87=BA=E3=81=97=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E3=81=AE=E8=A8=80=E3=81=84=E5=9B=9E=E3=81=97=E3=82=92?= =?UTF-8?q?=E4=BB=96=E3=81=A8=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reference/network/functions/request-parse-body.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/network/functions/request-parse-body.xml b/reference/network/functions/request-parse-body.xml index c43887b755a..00e30cc3e33 100644 --- a/reference/network/functions/request-parse-body.xml +++ b/reference/network/functions/request-parse-body.xml @@ -5,7 +5,7 @@ request_parse_body - リクエストボディを読み取り、解析して結果を返します + リクエストボディを読み取り、解析して結果を返す