Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Config/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions user_guide_src/source/installation/upgrade_440.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <curlrequest-sharing-options>` has been change to ``false``.
- app/Config/Exceptions.php
- Added the new method ``handler()`` that define custom Exception Handlers.
See :ref:`custom-exception-handlers`.
Expand Down
14 changes: 10 additions & 4 deletions user_guide_src/source/libraries/curlrequest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

*******************
Expand Down
3 changes: 1 addition & 2 deletions user_guide_src/source/libraries/curlrequest/001.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class CURLRequest extends BaseConfig
{
public $shareOptions = false;

// ...
public bool $shareOptions = true;
}