Skip to content

Commit 1df1034

Browse files
authored
Merge pull request #7638 from kenjis/config-CURLRequest-shareOptions
config: change default value of CURLRequest::$shareOptions
2 parents aab7037 + 15677c3 commit 1df1034

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

app/Config/CURLRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class CURLRequest extends BaseConfig
1616
* If true, all the options won't be reset between requests.
1717
* It may cause an error request with unnecessary headers.
1818
*/
19-
public bool $shareOptions = true;
19+
public bool $shareOptions = false;
2020
}

user_guide_src/source/installation/upgrade_440.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ and it is recommended that you merge the updated versions with your application:
153153
Config
154154
------
155155

156+
- app/Config/CURLRequest.php
157+
- The default value of :ref:`$shareOptions <curlrequest-sharing-options>` has been change to ``false``.
156158
- app/Config/Exceptions.php
157159
- Added the new method ``handler()`` that define custom Exception Handlers.
158160
See :ref:`custom-exception-handlers`.

user_guide_src/source/libraries/curlrequest.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,23 @@ to change very little to move over to use Guzzle.
2323
Config for CURLRequest
2424
**********************
2525

26+
.. _curlrequest-sharing-options:
27+
2628
Sharing Options
2729
===============
2830

29-
Due to historical reasons, by default, the CURLRequest shares all the options between requests.
30-
If you send more than one request with an instance of the class,
31-
this behavior may cause an error request with unnecessary headers and body.
31+
.. note:: Since v4.4.0, the default value has been changed to ``false``. This
32+
setting exists only for backward compatibility. New users do not need to
33+
change the setting.
3234

33-
You can change the behavior by editing the following config parameter value in **app/Config/CURLRequest.php** to ``false``:
35+
If you want to share all the options between requests, set ``$shareOptions`` to
36+
``true`` in **app/Config/CURLRequest.php**:
3437

3538
.. literalinclude:: curlrequest/001.php
3639

40+
If you send more than one request with an instance of the class, this behavior
41+
may cause an error request with unnecessary headers and body.
42+
3743
.. note:: Before v4.2.0, the request body is not reset even if ``$shareOptions`` is false due to a bug.
3844

3945
*******************

user_guide_src/source/libraries/curlrequest/001.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class CURLRequest extends BaseConfig
88
{
9-
public $shareOptions = false;
10-
119
// ...
10+
public bool $shareOptions = true;
1211
}

0 commit comments

Comments
 (0)