Bug #64247 [Opn->Fbk]: CURLOPT_INFILE doesn't allow reset for FTP

From: Date: Sun, 16 Jun 2013 23:46:50 +0000
Subject: Bug #64247 [Opn->Fbk]: CURLOPT_INFILE doesn't allow reset for FTP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-179587@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64247&edit=1

 ID:                 64247
 Updated by:         stas@php.net
 Reported by:        marco at m-s-d dot eu
 Summary:            CURLOPT_INFILE doesn't allow reset for FTP
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            cURL related
 Operating System:   Linux 3.0.0-1-amd64 #1 SMP
 PHP Version:        master-Git-2013-02-19 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Please add a test to the patch.


Previous Comments:
------------------------------------------------------------------------
[2013-02-19 20:43:38] 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),



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64247&edit=1


Thread (5 messages)

« previous php.bugs (#179587) next »