note 24769 deleted from function.tempnam by sniper
| From: | sniper@php.net | Date: | Tue, 08 Apr 2003 20:27:13 +0000 |
| Subject: | note 24769 deleted from function.tempnam by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46372@lists.php.net to get a copy of this message | ||
The autocreation of the file (with PHP 4) can cause problems if you are not expecting it. I was
running a simple PGP encryption script on PHP3, piping the clear text into stdin and specifying the
output from tempnam() as the output file. This worked fine. WIth PHP4, the script just hung. After a
lot of head-scratching (and searching for docs on popen/pclose), I read this page in more detail.
When using pgpe, if the output file exists you will be prompted whether you wish to overwrite it.
This was being ignored which was causing the hang. I can't see an option to pgpe to tell it to
ignore existing files, so a quick unlink() of the temp file fixed the problem (but perhaps
reinstates the race-condition that pre-creating the file was meant to avoid).