Bug #66109 [NEW]: Option CURLOPT_CUSTOMREQUEST can't be reset to default.
| From: | datibbaw@php.net | Date: | Mon, 18 Nov 2013 04:24:45 +0000 |
| Subject: | Bug #66109 [NEW]: Option CURLOPT_CUSTOMREQUEST can't be reset to default. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-182805@lists.php.net to get a copy of this message | ||
From: datibbaw@php.net
Operating system: n/a
PHP version: 5.5Git-2013-11-18 (Git)
Package: cURL related
Bug Type: Bug
Bug description:Option CURLOPT_CUSTOMREQUEST can't be reset to default.
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 bug report at https://bugs.php.net/bug.php?id=66109&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66109&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66109&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66109&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66109&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66109&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66109&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66109&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66109&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66109&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66109&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66109&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66109&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66109&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66109&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66109&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66109&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66109&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66109&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66109&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66109&r=mysqlcfg