Bug #66109 [Opn->Csd]: Option CURLOPT_CUSTOMREQUEST can't be reset to default.
| From: | datibbaw@php.net | Date: | Fri, 28 Feb 2014 14:47:41 +0000 |
| Subject: | Bug #66109 [Opn->Csd]: Option CURLOPT_CUSTOMREQUEST can't be reset to default. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184474@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66109&edit=1
ID: 66109
Updated by: datibbaw@php.net
Reported by: datibbaw@php.net
Summary: Option CURLOPT_CUSTOMREQUEST can't be reset to
default.
-Status: Open
+Status: Closed
Type: Bug
Package: cURL related
Operating System: n/a
PHP Version: 5.5Git-2013-11-18 (Git)
-Assigned To:
+Assigned To: datibbaw
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2013-11-18 04:24:45] datibbaw@php.net
Description:
------------
The documentation of cURL regarding the CURLOPT_CUSTOMREQUEST option mentions the following:
> Restore to the internal default by setting this to NULL.
Source: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCUSTOMREQUEST
However, the option value gets cast to a string before the call to curl_easy_setopt() is made, thus
changing the NULL value to an empty string. It should be possible to reset the internal behaviour by
passing a NULL value, i.e.
> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, NULL);
This problem is also highlighted in this SO question: http://stackoverflow.com/questions/4163865/how-to-reset-curlopt-customrequest
Test script:
---------------
$ch = curl_init('http://localhost');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_exec($ch);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, NULL);
curl_exec($ch);
Expected result:
----------------
One DELETE request followed by one GET request.
Actual result:
--------------
One DELETE request followed by an invalid request (i.e.
/ HTTP/1.1)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66109&edit=1