From 6c3b6c4f1851854155dee228505c532c810f5e8f Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 29 Jun 2023 12:02:46 +0900 Subject: [PATCH 1/2] config: change the default value of $shareOptions to false --- app/Config/CURLRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Config/CURLRequest.php b/app/Config/CURLRequest.php index 6c3ed74aa987..5a3d4e9311b2 100644 --- a/app/Config/CURLRequest.php +++ b/app/Config/CURLRequest.php @@ -16,5 +16,5 @@ class CURLRequest extends BaseConfig * If true, all the options won't be reset between requests. * It may cause an error request with unnecessary headers. */ - public bool $shareOptions = true; + public bool $shareOptions = false; } From 15677c30c6ad898a13342d4b106f3abe40296211 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 29 Jun 2023 12:05:16 +0900 Subject: [PATCH 2/2] docs: update user guide --- user_guide_src/source/installation/upgrade_440.rst | 2 ++ user_guide_src/source/libraries/curlrequest.rst | 14 ++++++++++---- .../source/libraries/curlrequest/001.php | 3 +-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/installation/upgrade_440.rst b/user_guide_src/source/installation/upgrade_440.rst index c82723aa129d..39aa16e07716 100644 --- a/user_guide_src/source/installation/upgrade_440.rst +++ b/user_guide_src/source/installation/upgrade_440.rst @@ -153,6 +153,8 @@ and it is recommended that you merge the updated versions with your application: Config ------ +- app/Config/CURLRequest.php + - The default value of :ref:`$shareOptions ` has been change to ``false``. - app/Config/Exceptions.php - Added the new method ``handler()`` that define custom Exception Handlers. See :ref:`custom-exception-handlers`. diff --git a/user_guide_src/source/libraries/curlrequest.rst b/user_guide_src/source/libraries/curlrequest.rst index 18afd51f771c..d0741ee366b8 100644 --- a/user_guide_src/source/libraries/curlrequest.rst +++ b/user_guide_src/source/libraries/curlrequest.rst @@ -23,17 +23,23 @@ to change very little to move over to use Guzzle. Config for CURLRequest ********************** +.. _curlrequest-sharing-options: + Sharing Options =============== -Due to historical reasons, by default, the CURLRequest shares all the options between requests. -If you send more than one request with an instance of the class, -this behavior may cause an error request with unnecessary headers and body. +.. note:: Since v4.4.0, the default value has been changed to ``false``. This + setting exists only for backward compatibility. New users do not need to + change the setting. -You can change the behavior by editing the following config parameter value in **app/Config/CURLRequest.php** to ``false``: +If you want to share all the options between requests, set ``$shareOptions`` to +``true`` in **app/Config/CURLRequest.php**: .. literalinclude:: curlrequest/001.php +If you send more than one request with an instance of the class, this behavior +may cause an error request with unnecessary headers and body. + .. note:: Before v4.2.0, the request body is not reset even if ``$shareOptions`` is false due to a bug. ******************* diff --git a/user_guide_src/source/libraries/curlrequest/001.php b/user_guide_src/source/libraries/curlrequest/001.php index e89e0692462f..303366336dbb 100644 --- a/user_guide_src/source/libraries/curlrequest/001.php +++ b/user_guide_src/source/libraries/curlrequest/001.php @@ -6,7 +6,6 @@ class CURLRequest extends BaseConfig { - public $shareOptions = false; - // ... + public bool $shareOptions = true; }