php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64247 CURLOPT_INFILE doesn't allow reset for FTP
Submitted: 2013-02-19 20:43 UTC Modified: 2014-04-29 08:03 UTC
From: marco at m-s-d dot eu Assigned: mike
Status: Closed Package: cURL related
PHP Version: master-Git-2013-02-19 (Git) OS: Linux 3.0.0-1-amd64 #1 SMP
Private report: No CVE-ID:
 [2013-02-19 20:43 UTC] marco at m-s-d dot eu
Description:
------------
When trying to do a PUT request using CURLOPT_INFILE followed by a GET, then the 
GET will encounter a "Warning: curl_setopt_array(): supplied argument is not a 
valid File-Handle resource" if the file handle has been closed.

This is a bug because you're supposed to free handles when you're not using them.

Setting NULL like with CURLOPT_HEADERFUNCTION (see 
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHEADERFUNCTION) does 
not work, it gives "Warning: curl_setopt_array(): supplied argument is not a valid 
File-Handle resource".

See also Bug #44866 - leaking FDs is bad, bad program practice.

Test script:
---------------
http://pastebin.com/XLJsZ9JH - line 44 is the CURLOPT_INFILE=>NULL line.

Expected result:
----------------
Once CURLOPT_INFILE=>NULL has been set, I expect that the action of setting 
CURLOPT_INFILE=>$fp has been reversed (i.e. that curl has been reset to default),


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-16 23:46 UTC] stas@php.net
-Status: Open +Status: Feedback
 [2013-06-16 23:46 UTC] stas@php.net
Please add a test to the patch.
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2014-04-29 08:03 UTC] mike@php.net
-Assigned To: +Assigned To: mike
 [2014-04-29 08:03 UTC] mike@php.net
-Status: No Feedback +Status: Assigned
 [2014-04-30 07:30 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54fee59598082052395f4011931096babd6f4013
Log: fix bug #64247 (CURLOPT_INFILE doesn't allow reset)
 [2014-04-30 07:30 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2014-05-01 14:59 UTC] tyrael@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54fee59598082052395f4011931096babd6f4013
Log: fix bug #64247 (CURLOPT_INFILE doesn't allow reset)
 [2014-05-05 06:56 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54fee59598082052395f4011931096babd6f4013
Log: fix bug #64247 (CURLOPT_INFILE doesn't allow reset)
 [2014-05-05 07:00 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54fee59598082052395f4011931096babd6f4013
Log: fix bug #64247 (CURLOPT_INFILE doesn't allow reset)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC