Option CURLOPT_CUSTOMREQUEST can't be reset to default.

Bug #66109 Option CURLOPT_CUSTOMREQUEST can't be reset to default.
Submitted: 2013-11-18 04:24 UTC Modified: 2014-02-28 14:47 UTC
From: datibbaw@php.net Assigned: datibbaw (profile)
Status: Closed Package: cURL related
PHP Version: 5.5Git-2013-11-18 (Git) OS: n/a
Private report: No CVE-ID: None

 [2013-11-18 04:24 UTC] 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`)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2014-02-28 14:47 UTC] datibbaw@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: datibbaw