Bug #51802 [Fbk->NoF]: PHP temp files not deleted when also using a CGI script
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:16 +0000 |
| Subject: | Bug #51802 [Fbk->NoF]: PHP temp files not deleted when also using a CGI script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176847@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51802&edit=1
ID: 51802
Updated by: php-bugs@lists.php.net
Reported by: relayadmin at disney dot com
Summary: PHP temp files not deleted when also using a CGI
script
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: CGI/CLI related
Operating System: Windows Server 2003
PHP Version: 5.2.13
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2011-11-15 15:43:30] felipe@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2010-05-12 21:07:14] relayadmin at disney dot com
Description:
------------
This bug is very specific to Windows. When executing a generic file upload using PHP, if at anytime
while the file is being uploaded Apache then runs a CGI script like PERL or a C program, and the
upload ends while the CGI script is still running, the uploaded file(s) in the temp directory will
remain behind forever.
In order to avoid this the âphp_do_open_temporary_fileâ routine will have to not use the
âVCWD_OPEN_MODEâ routine to open the temp file. A generic Windows âopenâ call
allows child processes to inherit their handles. The temp file would need to be opened with a
âCreateFileâ call to open the file and specify the pSecurityAttributes option with
bInheritHandle set to FALSE so that a child process will not inherit the open file handle. The rub
is this call uses a non-compatible handle so everyone who uses this handle has to be modified as
well.
Test script:
---------------
Write or use any simple PHP upload program. Next use CGI program below -- it doesn't need to
do anything except take time. So start the PHP upload, then start the CGI program below from a
webpage. Make sure the PHP upload completes before the script ends.
#include <windows.h>
void main(){
Sleep(2*60*1000); // sleep 2 minutes
}
Expected result:
----------------
The file should be uploaded and the temp file in the temp directory should not be present when done.
It should be moved to the destination directory.
Actual result:
--------------
The temp file remains forever in the temp directory, though the file is copied correctly to the
destination directory.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51802&edit=1