|  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: Assigned: datibbaw
Status: Closed Package: cURL related
PHP Version: 5.5Git-2013-11-18 (Git) OS: n/a
Private report: No CVE-ID:
 [2013-11-18 04:24 UTC]
The documentation of cURL regarding the CURLOPT_CUSTOMREQUEST option mentions the following:

> Restore to the internal default by setting this to NULL.


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:

Test script:
$ch = curl_init('http://localhost');



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`)


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-28 14:47 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: datibbaw
 [2014-02-28 14:47 UTC]
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

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 12:01:35 2015 UTC