php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52202 CURL(OPT|INFO)_PRIVATE
Submitted: 2010-06-29 11:02 UTC Modified: 2010-11-30 14:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: uramihsayibok at gmail dot com Assigned: iliaa (profile)
Status: Closed Package: cURL related
PHP Version: 5.3.2, libcurl 7.20.0 OS: Win 7 x64
Private report: No CVE-ID: None
 [2010-06-29 11:02 UTC] uramihsayibok at gmail dot com
Description:
------------
(Background: curl_easy_setopt(3) supports a CURLOPT_PRIVATE that takes a char* and does nothing with it. It can then be retrieved with curl_easy_getinfo(3) and CURLINFO_PRIVATE -- cURL >=7.10.3)

While the two CURL*_PRIVATE constants aren't mentioned in any detail in the PHP manual, they are listed in cURL's predefined constants page, and using (eg) an array for the value results in an array->string conversion warning, so I guess there's at least a little bit of support somewhere.

However using them gives buggy results - mostly binary junk.

Test script:
---------------
$curl = curl_init("http://www.example.com");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_PRIVATE, "123"); // *
curl_exec($curl);

var_dump(curl_getinfo($curl, CURLINFO_PRIVATE));

// * mostly happens with numbers; try different string lengths

Expected result:
----------------
string(3) "123"

Actual result:
--------------
string([varies]) "[binary junk]"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-22 22:35 UTC] nefthy-php dot net at nefthy dot de
I can confirm this on Gentoo Linux, same PHP version. In the source code it gets the same treatment as CURL*_URL, so it could be a libcurl problem...
 [2010-07-22 22:38 UTC] nefthy-php dot net at nefthy dot de
It works fine on Debian with php 5.2.6 and libcurl 7.18.2
 [2010-07-23 00:21 UTC] uramihsayibok at gmail dot com
-PHP Version: 5.3.2 +PHP Version: 5.3.2, libcurl 7.20.0
 [2010-07-23 00:21 UTC] uramihsayibok at gmail dot com
...and doesn't work with 7.19.7 (Ubuntu, PHP 5.3.2)...
 [2010-07-23 01:13 UTC] nefthy-php dot net at nefthy dot de
also reproducable with php 5.2.13 and curl 7.21.0
 [2010-11-30 14:40 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=305850
Log: Fixed bug #52202 (CURLOPT_PRIVATE gets corrupted).
 [2010-11-30 14:40 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2010-11-30 14:40 UTC] iliaa@php.net
This bug has been fixed in SVN.

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/.
 
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