From: Bryan Davis Date: Thu, 12 Dec 2013 23:10:14 +0000 (-0700) Subject: Use TempFSFile in UploadFromUrl X-Git-Tag: 1.31.0-rc.0~17650^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=e4009c7367702ec1bf455dccde2980e6bfec33aa;p=lhc%2Fweb%2Fwiklou.git Use TempFSFile in UploadFromUrl Make it a little harder for the developer to leak files in the temp directory by managing the temporary file with a TempFSFile instance. Change-Id: I8bafc3a6e6212781d9e2e4f8f370ce7c446f1fd5 --- diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index 0201d5f4e2..6d956e2aa4 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -204,13 +204,16 @@ class UploadFromUrl extends UploadBase { } return Status::newGood(); } + /** * Create a new temporary file in the URL subdirectory of wfTempDir(). * * @return string Path to the file */ protected function makeTemporaryFile() { - return tempnam( wfTempDir(), 'URL' ); + $tmpFile = new TempFSFile( 'URL' ); + $tmpFile->bind( $this ); + return $tmpFile->getPath(); } /**