note 90248 added to function.tempnam

From: Date: Sun, 12 Apr 2009 09:47:55 +0000
Subject: note 90248 added to function.tempnam
Groups: php.notes 
Request: Send a blank email to php-notes+get-153112@lists.php.net to get a copy of this message
Warning! Many of the suggestions in the other posts here for "custom" tempfile or tempdir creation using this routine contain race conditions which open a system up to security problems. If you need a tempfile with a specified suffix inside of a php script, and you happen to be using a Linux server, you can simply use: exec('/bin/tempfile -s .pdf', $result); $tmpfile = $result[0]; Similarly, if you need a tempdir and you are using a Linux server, try: exec('/bin/mktemp -d', $result); $tmpdir = $result[0]; It may not be as elegant as using a pure php approach, but you can count on this being secure. ---- Server IP: 209.41.74.194 Probable Submitter: 75.79.40.3 ---- Manual Page -- http://www.php.net/manual/en/function.tempnam.php Edit -- https://master.php.net/note/edit/90248 Del: integrated -- https://master.php.net/note/delete/90248/integrated Del: useless -- https://master.php.net/note/delete/90248/useless Del: bad code -- https://master.php.net/note/delete/90248/bad+code Del: spam -- https://master.php.net/note/delete/90248/spam Del: non-english -- https://master.php.net/note/delete/90248/non-english Del: in docs -- https://master.php.net/note/delete/90248/in+docs Del: other reasons-- https://master.php.net/note/delete/90248 Reject -- https://master.php.net/note/reject/90248 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153112) next »