php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26060 Not closing download handles
Submitted: 2003-10-31 12:42 UTC Modified: 2003-11-25 15:32 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: datacompboy at mail dot ru Assigned:
Status: No Feedback Package: cURL related
PHP Version: 4.3.3 OS: Win2003 adv server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: datacompboy at mail dot ru
New email:
PHP Version: OS:

 

 [2003-10-31 12:42 UTC] datacompboy at mail dot ru
Description:
------------
I tried to download file with curl, parse it with external app, show output and kill temp file. But:
1. if php as isapi module - when several requests at one time some inputs are locked! Filemon says that it frees by some cmd.exe after all runned sub-processes already finished. Very strange!
2. if php as fastcgi - it often crashes with error in php_curl (all latest dlls in system32 upgraded; php4ts only in c:\php, php4isapi also in c:\php and no in c:\windows\system)
3. if php as cgi - all OK, except of when user cancelled download the script terminated, but shotdown_procedure not called, so temp files left.

Reproduce code:
---------------
<?ob_start(); $url="http://some.site.com";
  $oinfile = tempnam ("./", "URLIN");
  $infile = preg_replace("#.*[/\\\\](.*?)#","\$1",$oinfile);
  $ooutfile = tempnam ("./", "URLOU");
  $outfile = preg_replace("#.*[/\\\\](.*?)#","\$1",$ooutfile);
  register_shutdown_function(create_function('',
    "@unlink(\"$infile\"); @unlink(\"$outfile\"); @unlink(\"$oinfile\"); @unlink(\"$ooutfile\"); return 1;"));
  $inf = fopen($infile, "w");
  fwrite($inf, "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n");
  $ch = curl_init();
  curl_setopt ($ch, CURLOPT_URL, $url);
  curl_setopt ($ch, CURLOPT_FILE, $inf);
  $st=curl_exec ($ch);
  curl_close ($ch);
  fclose($inf);
  echo `filter.exe $lang $infile $outfile 2>&1`;
  ob_end_flush();
?>

Expected result:
----------------
No .tmp files not in windows\temp\ folder, not in script folder.

Actual result:
--------------
Some .tmp files left and in windows\temp, and in script folder.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-17 22:52 UTC] sniper@php.net
Maybe I didn't make it clear enough so let's try again:

Please provide a SHORT (max 20 lines) and complete example script preferrably one that can be run on command line (using PHP CLI)

 [2003-11-25 15:32 UTC] sniper@php.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 "Open". Thank you.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Apr 05 09:01:27 2020 UTC