php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50523 curl_getinfo() retains old data when handle reused
Submitted: 2009-12-18 18:51 UTC Modified: 2010-10-20 02:39 UTC
From: geozipp at excite dot com Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.*, trunk OS: *
Private report: No CVE-ID: None
 [2009-12-18 18:51 UTC] geozipp at excite dot com
Description:
------------
When the curl handle is reused, curl_getinfo() contains the previous 
download_content_length value if the current url header contains no 
Content-Length: header.

Reproduce code:
---------------
$url_list = array('http://example.com', 'http://php.net');
$ch = curl_init();
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
foreach ($url_list as $each) {
    curl_setopt($ch, CURLOPT_URL, $each);
    curl_exec($ch);
    echo curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) . "\n";
}
curl_close($ch);


Expected result:
----------------
"-1" as the last value, since the response from the second url 
(http://php.net) contains no Content-Length: line.

Actual result:
--------------
HTTP/1.1 200 OK
...(header lines)
Content-Length: 438

438

HTTP/1.1 200 OK
...(header lines

438


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-18 19:13 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-12-19 10:47 UTC] geozipp at excite dot com
The behavior is the same with that snapshot (5.3.2-dev), as well as with 6.0.0-dev.
 [2009-12-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-06-22 00:49 UTC] felipe@php.net
-Status: No Feedback +Status: Open -Operating System: Windows +Operating System: * -PHP Version: 5.3.1 +PHP Version: 5.*, trunk
 [2010-06-22 00:49 UTC] felipe@php.net
I can reproduce it.
 [2010-06-26 20:46 UTC] felipe@php.net
-Package: cURL related +Package: Documentation problem
 [2010-10-20 02:39 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=304521
Log: Fixed bug #50523 (curl_getinfo() retains old data when handle reused)
 [2010-10-20 02:39 UTC] kalle@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2010-10-20 02:39 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=4af7bcc276be5cd4f2416a5142a35b205ab8d04e
Log: Fixed bug #50523 (curl_getinfo() retains old data when handle reused)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC