Bug #62942 [NEW]: Setting CURLOPT_COOKIE with curl_setopt_array problem
| From: | ben at blinkmobile dot com dot au | Date: | Mon, 27 Aug 2012 01:53:39 +0000 |
| Subject: | Bug #62942 [NEW]: Setting CURLOPT_COOKIE with curl_setopt_array problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-172927@lists.php.net to get a copy of this message | ||
From: ben at blinkmobile dot com dot au
Operating system:
PHP version: 5.3.16
Package: cURL related
Bug Type: Bug
Bug description:Setting CURLOPT_COOKIE with curl_setopt_array problem
Description:
------------
Setting CURLOPT_COOKIE with curl_setopt_array must be done before setting
CURLOPT_COOKIEFILE or CURLOPT_COOKIEJAR.
I'm not sure if this is a bug, however I can't find documentation
explaining that
when using curl_setopt_array you need to set options in a particular
order.
It was working in PHP 5.3.13, however fails in 5.3.14 + 5.3.15
A change that could have caused this is
https://bugs.php.net/bug.php?id=61948
Test script:
---------------
$cookies = 'a=b';
// the following correctly attaches $cookies in PHP 5.3.13 but not PHP
5.3.14+
$options = array(
CURLOPT_URL => 'http://...',
CURLOPT_COOKIEFILE => '',
CURLOPT_COOKIEJAR => '',
CURLOPT_HEADER => true,
CURLOPT_COOKIE => $cookies,
);
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
// the following attaches $cookies correctly for all versions I have
tested
$options = array(
CURLOPT_URL => 'http://...',
CURLOPT_COOKIE => $cookies,
CURLOPT_COOKIEFILE => '',
CURLOPT_COOKIEJAR => '',
CURLOPT_HEADER => true,
);
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
--
Edit bug report at https://bugs.php.net/bug.php?id=62942&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62942&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62942&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62942&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62942&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62942&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62942&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62942&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62942&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62942&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62942&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62942&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62942&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62942&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62942&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62942&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62942&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62942&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62942&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62942&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62942&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62942&r=mysqlcfg