php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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

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
 [2014-02-28 14:47 UTC] datibbaw@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC